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

Re: copying <xsl:stylesheet> tag to output xsl file

Subject: Re: copying <xsl:stylesheet> tag to output xsl file
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 2 Jan 2002 14:47:13 +0000
tag to apply stylesheet xml
Hi Tony,

> Can some one tell me a way by which i can copy the <xsl:stylesheet>
> element to the output XSL file, & apply the templates on to the XML
> file so that the output of comes between
> <xsl:stylesheet version="1.0"  xmlns:my="http://mysite.com/mynamespace">
>         <!-- output from the XML file after applying the templates -->
> </xsl:stylesheet>
> tags.

The xsl:apply-templates applies templates to the children of the
xsl:stylesheet element because that's the current node at the point
where the xsl:apply-templates is used.

To apply templates to some other nodes, you need to select those nodes
explicitly. I'd store the document element of the XML file in a
variable, and then apply templates to that element, as follows:

<xsl:template match="/">
  <xsl:variable name="XMLcontent" select="*" />
  <xsl:for-each select="document('')/xsl:stylesheet">
      <xsl:apply-templates select="$XMLcontent" />

I hope that helps,


Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

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.