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

Re: :apply-templates in another document

Subject: Re: :apply-templates in another document
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 19 May 2003 10:06:08 +0100
apply template to a document
Hi Stefan,

> I need to apply-templates on a  second .xml file referenced by a first .xml
> where which references a .xsl sheet.
>
> I try following:
>          ...
>         <xsl:apply-templates 
> select="document(@tag)/tag/description/@*|node()">
>           <xsl:with-param name="level" select="$level"/>
>         </xsl:apply-templates>

The trouble is that the XPath you're using to select the content of
the document is parsed as:

  (document(@tag)/tag/description/@*) | node()

In other words, you apply templates to the attributes of the
<description> element in the second .xml file, and the node() children
of the context node in the first .xml file.

The easiest thing would be to change the select attribute to:

  document(@tag)/tag/description

and add a template that matched the <description> element and applied
templates to its attributes and children:

<xsl:template match="description">
  <xsl:param name="level" />
  <xsl:apply-templates select="@* | node()">
    <xsl:with-param name="level" select="$level" />
  </xsl:apply-templates>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.