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

exclude-result-prefixes and xsl:copy issue

Subject: exclude-result-prefixes and xsl:copy issue
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Fri, 01 Feb 2002 14:07:14 +0100
exclude result prefixes copy
Hi,
there is a note about exclude-result-prefixes in the XSLT spec:
> NOTE: ... specifying the prefix
> in the [xsl:]exclude-result-prefixes attribute will avoid
> superfluous namespace declarations in the result tree.
(Quote intentional snipped)

I have a sort of template framework to get HTML snippets into
various final layout (example drastically simplified):
 <t:template xmlns:t="my.namespace">
   <t:content>
    <p>some content</p>
   </t::content>
 </t:template>

 <xsl:stylesheet xmlns:xsl="..." xmlns:t="my.namespace"
   exclude-result-prefixes="t">
  <xsl:template match="t:template">
    <html>
      <body>
        <xsl:call-template name="navigation"/>
        <xsl:apply-templates select="t:content/*"/>
      </body>
    <html>
  </xsl:template>

  <!-- the copy template -->
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*">
    </xsl:copy>
  </xsl:template>
 </xsl:stylesheet>

The xsl:copy copies the t namespace node, as explicitely mentioned
in the spec, which in turn is serialized into the result, also more
or less explicitely mentioned in the XSLT 2.0 draft (not so clear
in 1.0), this yields
  <html>
    <body>
      <p xmlns:t="my.namespace">some content</p>
    </body>
  </html>
>From my point of view this is not in the spirit of the note quoted
at the beginning.
Is this an unintended consequence of how the 1.0 standard was written
or are there cases where this behaviour is useful or necessary?
Will it break existing style sheets or will it unnecessarily complicate
implementations if unecessary namespaces would also be excluded
from copied nodes?
Well, meanwhile i helped myself by replacing xsl:copy with
  <xsl:element name="{name()}">

 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.