|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] apply-template inside xsl:variable returns a document
I have an xml document in another namespace that I am performing a lookup
on. The result should be a single node (having attributes and elements). I
am assigning the result of this lookup to a variable so that the attributes
and elements can be accessed if and when needed without multiple lookups.
My problem is that I am getting the desired node as a child of a
documentFragment. I haven't a clue as to what a documentFragment is, why am
I getting it, how to get rid of it or otherwise work around it.
Here is the pertinent code:
<xsl:variable name="elementContent"
select="document('content.xml')/c:content/c:elements"/>
<xsl:key name="elementContentKey" match="c:element" use="@id"/>
<xsl:template match="c:elements">
<xsl:param name="elementName"/>
<xsl:copy-of select="key('elementContentKey', $elementName )"/>
</xsl:template>
and then in a template (in which context, @name is valued), I define the
variable $thisContent.
<xsl:variable name="thisContent">
<xsl:apply-templates select="$elementContent">
<xsl:with-param name="elementName" select="@name"/>
</xsl:apply-templates>
</xsl:variable>
The file content.xml has a structure like
<content>
<elements>
<element id="table">
<caption>Table</caption>
<description>Name of table in database</description>
<help href="table.help"/>
</element>
</elements>
...
</content>
I would like $thisContent to be equivalent to the single <element> shown
above, when @name = "table".
Thanks for any consideration of my problem.
Regards,
John
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








