Hi John !
<xsl:value-of select="$somenode/@attr" /> is not correct i think, the select
attribute shall be wheter an variable name precede with or an Xpath
expression.
<xsl:copy-of select="/root/node1" /> will actually return the xml fragment
of node1, but when doing <xsl:value-of select=""/> you will get the value of
this fragment.
I'm not sure I really got what you mean by "return a reference to a node" ?
An idea (maybe) is to use the generate-id() Xpath function which gives you
an single id for each node ?
hope this help.
Matthieu
-----Message d'origine-----
De : John [mailto:john-xsl-list(_at_)jpw3(_dot_)com]
Envoyé : jeudi 16 juin 2005 16:25
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : [xsl] Can a named template return a node list?
Sorry in advance for my terminology. Is it possible for a named
template to return a node list? Here is some simplified XML with which
I have been experimenting:
<root>
<node1 attr="node1attrval">
<node1a>node1atext</node1a>
</node1>
<node2 attr="node2attrval">
<node2a>node2atext</node2a>
</node2>
</root>
And the XSL I have been trying:
<xsl:template match="*">
<xsl:variable name="somenode">
<xsl:call-template name="sometemplate" />
</xsl:variable>
<xsl:value-of select="$somenode/@attr" />
</xsl:template>
<xsl:template name="sometemplate">
<xsl:copy-of select="/root/node1" />
</xsl:template>
The reference to $somenode/@attr gives an error. I think the problem is
with copy-of - I want it to return a reference to a node, but it seems
to return the value of the node. Is there some other function or
approach I should try? I have tried value-of and copy, and I am hoping
to stay away from XSL extensions if possible. I cannot use XSL 2.
Thanks,
-John
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--