Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Re: Using xsl:namespace-alias for XSL generation in Saxon 6.5.3

From: John Dawson <john.dawson@--------->
To:
Date: 8/3/2004 8:02:00 PM
Thanks to everybody (George Cristian Bina, Michael Kay, and David
Carlisle) for helping me out with this.  I hadn't actually noticed
that the output XSL that included the "emit" prefix was, in fact,
valid XSL.

The solution offered by George and Michael of using a substitute
prefix (like "xslt" or "x") for the "real" XSL code you want to
process and execute is somewhat unsatisfying, but it sounds like it's
the best that can be done.  It looks like if I'm really, really
determined to make it work the way I want (use 'xsl' prefix for normal
elements and 'emit' prefix for literal elements), I may have to make a
post-processor that converts the 'emit' prefix to the 'xsl' prefix.

John


On Mon, 2 Aug 2004 17:50:19 -0500, John Dawson <john.dawson@xxxxxxxxx> wrote:
> 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent