xsl-list
[Top] [All Lists]

Re: :apply-templates in another document

2003-05-19 02:06:08
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



<Prev in Thread] Current Thread [Next in Thread>