Subject: RE: Can't get predicates working.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 7 May 2005 22:40:55 +0100
|
If you show us the code you've written, someone will probably be able to
tell you where you've gone wrong. If you don't, they won't.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Marco Mastrocinque [mailto:mmfive@xxxxxxxxxxxxxxx]
> Sent: 07 May 2005 21:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Can't get predicates working.
>
>
> Hi All,
> I'm having trouble with a predicate selection (i.e. a
> conditional
> selection). For the following xml structure.
>
> <company>
> <division DID="XXX">
> <projects>
> <project PID='XYZ'> (Project ID)
> <PNAME>Some Name</PNAME> (Project Name)
> <BUDGET>111</BUDGET>
> <assigns>
> <assign refEID='XXX000'>
> <HOURS>12</HOURS>
> </assign>
> <assign refEID='XXX001'>
> <HOURS>78</HOURS>
> </assign>
> <assigns>
> </project>
> <project PID='XY1'>
> <PNAME>Some OtherName</PNAME>
> <BUDGET>112</BUDGET>
> <assigns>
> <assign refEID='XXX000'>
> <HOURS>34</HOURS>
> </assign>
> <assign refEID='XXX002'>
> <HOURS>1234</HOURS>
> </assign>
> <assigns>
> </project>
> Etc..
> </projects>
> <employees>
> <employee EID='XXX000'>
> <ENAME>Joe Blow</ENAME>
> <OFFICE>1204</OFFICE>
> <BIRTHDATE>1924-08-01</BIRTHDATE>
> </employee>
> <employee EID='XXX001'>
> <ENAME>Joe Smith</ENAME>
> <OFFICE>1203</OFFICE>
> <BIRTHDATE>1930-08-01</BIRTHDATE>
> </employee>
> <employee EID='XXX002'>
> <ENAME>Joe Jerry</ENAME>
> <OFFICE>0003</OFFICE>
> <BIRTHDATE>1930-08-01</BIRTHDATE>
> </employee>
> </employees>
> </division>
> Etc.. (there are multiple divisions with the same structure,
> employees can
> only work for one division and a project only belongs to a
> single division
> )
> </company>
>
> I won't to have a table that shows PID, PNAME, BUDGET and
> then the employee
> EID (unique identifier), the employee name (ENAME), OFFICE
> and HOURS spent
> on each project.
>
> The output I won't is
>
> Division Name = XXX
> PID='XYZ' PNAME=Some Name BUDGET=111
> EID= XXX000 ENAME= Joe Blow OFFICE=1204 HOURS=12
> EID= XXX001 ENAME= Joe Smith OFFICE=1203 HOURS=78
>
> PID=' XY1' PNAME= Some OtherName BUDGET=112
> EID= XXX000 ENAME= Joe Blow OFFICE=1204 HOURS=34
> EID= XXX002 ENAME= Joe Jerry OFFICE=0003 HOURS=1234
>
> This above output is done for every division.
>
> I have to match the refEID attribute of assign element with the EID
> attribute of employee element. Then out the EID (refEID),
> with the ENAME and
> OFFICE elements, while looping the projects for each
> division. I know it is
> a conditional selection (I think?), but I just can't get working.
>
>
> Thanks Marco Mastrocinque
|