This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: getting the node position in source xml in a variable
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Gurvinder Singh <GurvinderS at amdocs dot com>
- Cc: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 27 Feb 2002 15:11:58 +0000
- Subject: Re: [xsl] getting the node position in source xml in a variable
- Organization: Jeni Tennison Consulting Ltd
- References: <D1713728C4550440A0E4A0816702E75C02E375C9@cypmail1srv.corp.amdocs.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Gurvinder,
> I have one more query... you said that i am not passing the result
> tree fragment what does it mean... i thought when i select nodes and
> pass it as parameter is is passing result tree fragment
No - when you select nodes and pass them using the select attribute of
xsl:with-param, then you pass those nodes as a *node set*. It's only
if you use the *content* of the xsl:with-param that you create a
result tree fragment. For example, if you did:
<xsl:call-template name="lookup">
<xsl:with-param name="name">test</xsl:with-param>
<xsl:with-param name="nodes">
<xsl:copy-of select="/test/Level2" />
</xsl:with-param>
</xsl:call-template>
With this call, both $name and $nodes are result tree fragments.
It doesn't matter too much with $name, because it's a result tree
fragment whose root node only has one child - a text node with the
value 'test' - although a result tree fragment is a little more
unweildy for the processor than a plain string would be.
On the other hand, the $nodes parameter is set to a result tree
fragment whose root node has a number of Level2 element children.
Because that result tree fragment has structure, you usually have to
convert it back into a node set (e.g. using msxsl:node-set()) to do
anything useful with it.
This means that in general you should use the select attribute to set
the values of variable-binding elements, such as xsl:variable,
xsl:param and xsl:with-param.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list