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

Using xsl:namespace-alias for XSL generation in Saxon

Subject: Using xsl:namespace-alias for XSL generation in Saxon 6.5.3
From: John Dawson <john.dawson@xxxxxxxxx>
Date: Mon, 2 Aug 2004 17:50:19 -0500
saxon namespace
Hi!

I would love to be able to use namespace aliasing to
conveniently write XSL that generates more XSL.  I've got an
incantation for this that seems to work on many different
XSL processors (including Saxon 7.9.1), but not on the one
processor that I am constrained to use, Saxon 6.5.3.

Input XML:

  <doc/>

Input XSL:

  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:emit="map_to_xsl">
  <xsl:output method="xml" indent="yes"/>
  <xsl:namespace-alias stylesheet-prefix="emit"
                       result-prefix="xsl"/>

  <xsl:template match="/">
      <emit:stylesheet version="1.0"
                       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <emit:output method="xml" indent="yes"/>
      <emit:template match="/">
          <foo>
          </foo>
      </emit:template>
      </emit:stylesheet>
  </xsl:template>

  </xsl:stylesheet>

What I'd like for this to produce, and what it does seem to
produce with most XSL processors:

  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="xml" indent="yes"/>
     <xsl:template match="/">
        <foo/>
     </xsl:template>
  </xsl:stylesheet>

What Saxon 6.5.3 produces:

  <?xml version="1.0" encoding="utf-8"?>
  <emit:stylesheet xmlns:emit="http://www.w3.org/1999/XSL/Transform"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                   version="1.0">
     <emit:output method="xml" indent="yes"/>
     <emit:template match="/">
        <foo/>
     </emit:template>
  </emit:stylesheet>

I have found a few posts with Michael Kay trying to explain
Saxon 6.5.3's behavior for xsl:namespace-alias and
exclude-result-prefix.  I freely admit that I can't
understand the answers, apart from the gist:  "Sorry, the
XSL 1.0 spec doesn't say what namespace the serializer has
to output, so whatever Saxon 6.5.3 does is by definition
conformant."  (I'm paraphrasing)

I can accept this, but I can't help but think that there is
some way to get Saxon 6.5.3 do what I want.  I can tell that
Michael is an extremely smart guy and that Saxon is
high-quality software, and this seems like an obvious thing
to want to do.  All the xsl:element and xsl:attribute
verbiage gets tedious and hard to read when it's generating
more XSL for output.  Thus I'm hopeful it can do it somehow.

Any assistance appreciated.

John

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.