Subject: RE: Using xsl:namespace-alias for XSL generation in Saxon 6.5.3
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 3 Aug 2004 00:29:32 +0100
|
The obvious way to get Saxon 6.5.3 to use the "xsl" prefix in the output is
to switch your usage in the stylesheet: use "x:stylesheet" for the XSLT
instructions and "xsl:stylesheet" for the literal result elements, with
stylesheet-prefix="xsl" result-prefix="x".
I did eventually change this because although it conformed to the XSLT 1.0
rules, it wasn't what people expected or wanted. The XSLT 2.0 rules are much
more precise.
Michael Kay
> -----Original Message-----
> From: John Dawson [mailto:john.dawson@xxxxxxxxx]
> Sent: 02 August 2004 23:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Using xsl:namespace-alias for XSL generation
> in Saxon 6.5.3
>
> 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
|