[xsl] Re-visiting a Child Node

Subject: [xsl] Re-visiting a Child Node
From: "Daniel Newman" <daniel.newman@xxxxxxxxxxx>
Date: Mon, 9 Apr 2001 17:07:27 +0100
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" />
	    <td bgcolor="{$RowColor}" valign="top" width="45%">
		<b><font face="Arial, Helvetica, sans-serif" size="2">
			<xsl:value-of select="$DisplayText" />
		    <td bgcolor="{$RowColor}" width="45%"><font face="Arial, Helvetica,
sans-serif" size="2">

			<xsl:apply-templates select="*[name()=$ChildNode]" />
			<!--<xsl:value-of select="$SelectNode" />-->

	    <td bgcolor="#000066" width="5%"><br/></td>
	    <td bgcolor="#FF9933" width="5%"><br/></td>

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 name="PrintTable">
  <xsl:apply-templates />

<xsl:template match="RetrieveNameAndAddressRSResponse">

<xsl:template match="msg_holding_information">
	<xsl:apply-templates select="../RetrieveClassInfoRSResponse" />

<xsl:template match="RetrieveClassInfoRSResponse">

<xsl:template match="RetrieveNameAndAddressRSResponse">

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:

			<item id="1">
			<item id="2">
			<Item id="1">
			<Item id="2">
			<Item id="3">
			<Item id="4">
			<Item id="5">
			<Item id="6">

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

Current Thread