This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Writing a stylesheet to create a stylesheet, with XSLT in the XML
- From: "Scott Moore" <puffandtoot at cox dot net>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 18 Jun 2002 09:30:41 -0400
- Subject: Re: [xsl] Writing a stylesheet to create a stylesheet, with XSLT in the XML
- References: <63C4AD0365821F4291ACF76C0672FA3506EEA5@piper6.piper-group.int>
- Reply-to: xsl-list at lists dot mulberrytech dot com
[snip]
> And then you could use namespace-alias and the-power-of-xml to get the
> result you want:
>
> For this xml:
>
> <root>
> <node>My name is <path>/Doc/FirstName</path>.</node>
> </root>
>
> And this stylesheet:
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xslt="some_made_up_namespace"
> version="1.0">
>
> <xsl:namespace-alias
> stylesheet-prefix="xslt"
> result-prefix="xsl"/>
>
> <xsl:template match="//node">
> <xsl:variable name="path" select="path"/>
> <xslt:stylesheet>
> <xslt:value-of select="{$path}"/>
> </xslt:stylesheet>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> You get this result:
>
> <?xml version="1.0" encoding="UTF-16"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:value-of select="/Doc/FirstName" />
> </xsl:stylesheet>
>
>
> Im sure this is what you need, but I dont want to second guess your reqs
> - let us know if this is what you want.
This would work fine except we already have a rather robust infrastructure
and schema around the XML file. To do it your way would require an enormous
amount of rewriting, something just not possible at this time.
It pretty much boils down to the fact that the least amount of work dictates
the use of an attribute, whose value can contain both static and dynamic
(from the DOM) text, which will be placed in the header/footer of the
report. Originally I wanted to embed XSLT in the attribute, but ended up
with the string parsing routine instead, which works pretty good. The only
downside is the character | can't be part of the static text, but I really
don't think that's ever going to be a problem. And I could enhance the
parser to fix it if it ever was a problem.
Scott
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list