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

RE: Namespace-aliasing and excluded namespaces

Subject: RE: Namespace-aliasing and excluded namespaces
From: "Buchcik, Kasimier" <k.buchcik@xxxxxxxxxxxx>
Date: Wed, 10 May 2006 20:50:51 +0200
xmlns xslt
Hi,

> -----Original Message-----
> From: Buchcik, Kasimier [mailto:k.buchcik@xxxxxxxxxxxx]

[...]

It seems like the XSLT 2.0 rules produce an effect,
which hinders the elimination of the stylesheet's XSLT-namespace
declaration with the prefix "xsl":

"ns-alias-1.xsl"
----------------
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:axsl="http://www.w3.org/1999/XSL/Transform-alias"
  xmlns:my-xsl="http://www.w3.org/1999/XSL/Transform"
  exclude-result-prefixes="axsl xsl my-xsl">

  <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="my-xsl"/>

  <xsl:template match="/">
    <axsl:stylesheet version="2.0"/>
  </xsl:template>

</xsl:stylesheet>


Result with Saxon 8.1.1:

<my-xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:my-xsl="http://www.w3.org/1999/XSL/Transform"/>

This is just an observation; I doubt anyone insists on generating
an other prefix than the one used for the stylesheet itself.


* Another observation is that this effect will also preserve the
XSLT-namespace declarations produced by templates of imported/included
stylesheets if the prefix differs:

Result with Saxon 8.1.1:

<?xml version='1.0' ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template name="foo">
    <!-- Note the XSLT-namespace declaration with the prefix "xslt" in
the result. -->
    <zoo xmlns:xslt="http://www.w3.org/1999/XSL/Transform"/>
  </xsl:template>
</xsl:stylesheet>

Scenario:

"ns-alias-2.xsl"
----------------
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:axsl="http://www.w3.org/1999/XSL/Transform-alias"
  exclude-result-prefixes="axsl xsl">
  <xsl:output indent="yes"/>

  <xsl:include href="ns-alias-inc.xsl"/>

  <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>

  <xsl:template match="/">
    <axsl:stylesheet version="2.0">
      <axsl:template name="foo">
        <xsl:call-template name="zoo"/>
      </axsl:template>
    </axsl:stylesheet>
  </xsl:template>

</xsl:stylesheet>

"ns-alias-imp.xsl"
------------------
<xslt:stylesheet version="2.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
  <xslt:template name="zoo">
    <!-- Note the XSLT-namespace declaration with the prefix "xslt" in
the result. -->
    <zoo/>
  </xslt:template>
</xslt:stylesheet>

Regards,

Kasimier

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.