RE: [xsl] Re-visiting a Child Node

Subject: RE: [xsl] Re-visiting a Child Node
From: "Daniel Newman" <daniel.newman@xxxxxxxxxxx>
Date: Tue, 10 Apr 2001 09:24:45 +0100
This could get quite complicated, but the table I want to produce looks

The XML will have the following structure:

Back to the html table, columns Holder Name, Direct Credit Instructions,
Dividend Reinvestment Plan and Annual Report Instructions come from the
RetrieveNameAndAddressRSResponse node, and table column Holding Balance
comes from msg_holding_information, with some details from
RetrieveClassInfoRSResponse (class = class_code).

My only thought at this time is to process the
RetrieveNameAndAddressRSResponse node first, storing the values I want as
local variables, and then print them to the page when needed?

But, I can't see why I can't use my initial function/template to generate
the table rows:

<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/$SelectNode]" />
	    <td bgcolor="#000066" width="5%"><br/></td>
	    <td bgcolor="#FF9933" width="5%"><br/></td>

As this would make my code so much easier!

Any ideas?


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jeni Tennison
Sent: 10 April 2001 00:02
To: Daniel Newman
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re-visiting a Child Node

Hi Daniel,

> 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?

It *looks* as though you're suffering a fundamental misunderstanding
about how XSLT works. In your code you have two templates that match
RetrieveNameAndAddressRSResponse elements, and you seem to be
expecting that they are applied in turn.

That's not how XSLT works. In XSLT, the processor visits nodes
within the node tree, and for each of the nodes, it tries to find
*the* template that matches that node, and then follows the
instruction in that template.  If you have two templates that have
exactly the same match pattern (the content of the 'match' attribute),
then the one that appears last in your stylesheet is the one that will
be used.

So it's not that the second template wipes over what's generated from
the first template, it's that when the
RetrieveNameAndAddressRSResponse element has templates applied to it,
both templates match it, but the processor can only apply one so it
applies the last one in the stylesheet.  The first template never gets
applied at all.

I'm not completely clear on what you're trying to get out - why the
dynamic XPath stuff is necessary for your problem. It would be really
helpful if you would post an example of the table that you want to
get, so that we can look at various ways of getting it.

If you really need dynamic XPath evaluation, then you might want to
see whether your processor can help - it might support an evaluate()
function (e.g. saxon:evaluate()) or allow you to write a user-defined
function that can do the same kind of thing (e.g. through DOM
manipulation in MSXML).



Jeni Tennison

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread