  | |  how to select another rowset with an id based on an id in the cur
rent rowset | how to select another rowset with an id based on an id in the cur
rent rowset 2003-05-19 - By Tsui, Alban
Hi I have the following:
<document> <rowset1> <object1> <id>1</id> <value>a</value> <object1> </object1> <id>2</id> <value>b</value> </object1> <object1> <id>3</id> <value>c</value> </object1> </rowset1> <rowset2> <object2> <id>2</id> </object2> <object2> <id>3</id> </object2> </rowset2> </document>
so I have the following transform fragment:
<xsl:for-each select="/document/rowset2/object2"> <!-- in current object2 context --> <xsl:value-of select="/document/rowset1/object1[id=child::id]/value"/> </xsl:for-each> but it doesn't seem to work. What I am trying to do is to iterate each "object2" in rowset2 to fetch the value from object1 from rowset1 based on the "id" value but I am struggling with the xpath condition in the sqaure brackets. What have I done wrong here?
A.T.
This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.89"> <TITLE>how to select another rowset with an id based on an id in the current rowset</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2 FACE="Arial">Hi I have the following:</FONT> </P>
<P><FONT SIZE=2 FACE="Arial"><document></FONT> <BR> <FONT SIZE=2 FACE="Arial">< ;rowset1></FONT> <BR> <FONT SIZE=2 FACE="Arial"><object1></FONT> <BR> <FONT SIZE=2 FACE="Arial "><id>1</id></FONT> <BR> <FONT SIZE=2 FACE="Arial "><value>a</value></FONT> <BR> <FONT SIZE=2 FACE="Arial"><object1></FONT> <BR> <FONT SIZE=2 FACE="Arial"></object1></FONT> <BR> <FONT SIZE=2 FACE="Arial "><id>2</id></FONT> <BR> <FONT SIZE=2 FACE="Arial "><value>b</value></FONT> <BR> <FONT SIZE=2 FACE="Arial"></object1></FONT> <BR> <FONT SIZE=2 FACE="Arial"><object1></FONT> <BR> <FONT SIZE=2 FACE="Arial "><id>3</id></FONT> <BR> <FONT SIZE=2 FACE="Arial "><value>c</value></FONT> <BR> <FONT SIZE=2 FACE="Arial"></object1></FONT> <BR> <FONT SIZE=2 FACE="Arial">< /rowset1></FONT> <BR> <FONT SIZE=2 FACE="Arial">< ;rowset2></FONT> <BR> <FONT SIZE=2 FACE="Arial"><object2></FONT> <BR> <FONT SIZE=2 FACE="Arial "><id>2</id></FONT> <BR> <FONT SIZE=2 FACE="Arial"></object2></FONT> <BR> <FONT SIZE=2 FACE="Arial"><object2></FONT> <BR> <FONT SIZE=2 FACE="Arial "><id>3</id></FONT> <BR> <FONT SIZE=2 FACE="Arial"></object2></FONT> <BR> <FONT SIZE=2 FACE="Arial">< /rowset2></FONT> <BR><FONT SIZE=2 FACE="Arial"></document></FONT> </P>
<P><FONT SIZE=2 FACE="Arial">so I have the following transform fragment:</FONT> </P>
<P> <FONT SIZE=2 FACE="Arial"><xsl :for-each select="/document/rowset2/object2"></FONT> <BR> <FONT SIZE=2 FACE="Arial"><!-- in current object2 context --> </FONT> <BR> <FONT SIZE=2 FACE="Arial"><xsl:value-of select="/document /rowset1/object1[id=child::id]/value"/></FONT> <BR> <FONT SIZE=2 FACE="Arial">< /xsl:for-each></FONT> <BR><FONT SIZE=2 FACE="Arial">but it doesn't seem to work.</FONT> <BR><FONT SIZE=2 FACE="Arial">What I am trying to do is to iterate each " ;object2" in rowset2 to fetch the value from object1 from rowset1 based on the "id" value but I am struggling with the xpath condition in the sqaure brackets. What have I done wrong here?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">A.T.</FONT> </P> <BR>
<P><FONT SIZE=2 FACE="Arial">This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.</FONT></P>
</BODY> </HTML>
|
|
 |