Subject: [xsl] Re: Using xsl:namespace-alias for XSL generation in Saxon 6.5.3 From: John Dawson <john.dawson@xxxxxxxxx> Date: Tue, 3 Aug 2004 15:01:28 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using xsl:namespace-alias, David Carlisle | Thread | [xsl] Use of xsl:number, ignoring s, Marina Cuello |
RE: [xsl] FMPro, XSL eliminate dup , Michael Kay | Date | RE: [xsl] transforming xml to text , cknell |
Month |