[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re-visiting a Child Node
I'm trying to find a work around to my "accessing dynamic nodes" problem from this morning. It looks as though I'm unable to build a dynamic XPath. There is a little workaround, but it's not right for me. I want to be able to start at the root, and use the following template: <xsl:template name="PrintRows"> <xsl:param name="ChildNode" /> <xsl:param name="SelectNode" /> <xsl:param name="RowColor" /> <xsl:param name="DisplayText" /> <tr> <td bgcolor="{$RowColor}" valign="top" width="45%"> <b><font face="Arial, Helvetica, sans-serif" size="2"> <xsl:value-of select="$DisplayText" /> </font></b> </td> <td bgcolor="{$RowColor}" width="45%"><font face="Arial, Helvetica, sans-serif" size="2"> <xsl:apply-templates select="*[name()=$ChildNode]" /> <!--<xsl:value-of select="$SelectNode" />--> </font></td> <td bgcolor="#000066" width="5%"><br/></td> <td bgcolor="#FF9933" width="5%"><br/></td> </tr> </xsl:template> As you can see, I'm trying to get the value of $SelectNode from $ChildNode, but it won't let me do this. SO, I thought I'd try restructuring my page to access the individual nodes in turn. This causes a problem though, as I want to access Child[1], then Child[2], then back to Child[1]. If I use this code <html code has been removed>: <xsl:template match="/Shareholder_Summary"> <xsl:call-template name="PrintTable" /> </xsl:template> <xsl:template name="PrintTable"> <xsl:apply-templates /> </xsl:template> <xsl:template match="RetrieveNameAndAddressRSResponse"> </xsl:template> <xsl:template match="msg_holding_information"> <xsl:apply-templates select="../RetrieveClassInfoRSResponse" /> </xsl:template> <xsl:template match="RetrieveClassInfoRSResponse"> </xsl:template> <xsl:template match="RetrieveNameAndAddressRSResponse"> </xsl:template> The second call to RetrieveNameAndAddressRSResponse wipes everything that came before it. How can I revisit this part of the tree without the page erasing the previous code? below is an example of the XML tree: <Shareholder_Summary> <RetrieveNameAndAddressRSResponse> </RetrieveNameAndAddressRSResponse> <msg_holding_information> <return_status>0</return_status> <no_of_items>2</no_of_items> <items> <item id="1"> </item> <item id="2"> </item> </items> </msg_holding_information> <RetrieveClassInfoRSResponse> <return_status>0</return_status> <NoOfItems>6</NoOfItems> <Items> <Item id="1"> </Item> <Item id="2"> </Item> <Item id="3"> </Item> <Item id="4"> </Item> <Item id="5"> </Item> <Item id="6"> </Item> </Items> </RetrieveClassInfoRSResponse> </Shareholder_Summary> Hope someone out there can help, as I want to produce a nice simple XSLT file that produces a little table, but at the moment it's looking like I'm going to have to write huge amounts of code to get around XSL's lack of dynamic XPath support? Thank you, Daniel Newman. Bis-Web Ltd. Tel: 01993 880614 Fax: 01993 881625 **************************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **************************************************************************** XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|