[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

apply-template inside xsl:variable returns a document

Subject: apply-template inside xsl:variable returns a documentFragment with a child node tree
From: "John P. Flanigan [Software Technology Initiative, Inc.]" <JFlanigan@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Feb 2006 05:47:35 -0500
xsl apply template 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"
  <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 )"/>

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"/>

The file content.xml has a structure like

      <element id="table">
        <description>Name of table in database</description>
        <help href="table.help"/>

I would like $thisContent to be equivalent to the single <element> shown
above, when @name = "table".

Thanks for any consideration of my problem.


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.