Subject: Silly Newbie XSLT Question - updated. Wasnt too clear first time (sorry)
From: "LAJ" <shaard@xxxxxxxxxxxxxx>
Date: Tue, 3 Jul 2001 14:43:59 +0100
|
Sorry to bother you all with something trivial but I was hoping I could get
an explanation of something.
A bit of background : Im using the document function to look up some
information in another XML file from an XSLT template. Im having to call
SLIGHTLY MODIFIED versions of this template 3 times in order to retrieve
*slightly* different output.
Ideally what Id like to do is call one template once and return a
dynamically generated tree fragment, return it to a variable and then output
the individual nodes. I've had no luck doing this so I put together a
simplified example of my problem.
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:variable name="test">
<xsl:call-template name="test"/>
</xsl:variable>
<xsl:value-of select="$test//node1"/>
<xsl:value-of select="$test//node2"/>
<xsl:value-of select="$test//node3"/>
</xsl:template>
<xsl:template name="test">
<root>
<node1>data refererenced from another document</node1>
<node2>slightly different data refererenced from the same document as
node1</node2>
<node3>slightly different data refererenced from the same document as
node1</node3>
</root>
</xsl:template>
</xsl:stylesheet>
The xml can be anything that uses this stylesheet.
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="/test.xsl" ?>
<test>
test
</test>
Now when I try this I get the error "reference to parameter or varibale test
must evaluate to a node list".
What am I doing wrong or have I fundamentally misunderstood something here?
Im using MSXML3.0 BTW
Many thanks
Lee
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|