This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Multiple output types and embedded documentation
- To: xsl-list at mulberrytech dot com
- Subject: Re: Multiple output types and embedded documentation
- From: Warren Hedley <w dot hedley at auckland dot ac dot nz>
- Date: Mon, 03 Jul 2000 11:05:36 -0400
- CC: "Pawson, David" <DPawson at rnib dot org dot uk>, David Carlisle <davidc at nag dot co dot uk>
- Organization: Department of Engineering Science, The University of Auckland
- References: <39B19660C174D311BB9000A0C9E01C3F317EC9@corfu.rnib.org.uk>
- Reply-To: xsl-list at mulberrytech dot com
Obviously I needed more exclamation marks in my subject !!!! It took
so long for anyone to respond, I thought it must have been deleted
somewhere and I'd have to repost.
"Pawson, David" wrote:
>
> Presumably, using this format, you would swap out the namespace
> of either out_1 or out_2 and replace it with the xsl namespace, to
> select the actual output wanted?
Precisely.
> 1. How do you 'disable' output from the undesired namespaces
> when not in use.
> 2. I don't understand the 'intermediate step' idea above.
David Carlisle has already posted one answer to these questions, but
I think it should be possible to have a more general solution, where
the user can use whatever namespaces they like, and command line
parameters are given to the "intermediate step" stylesheet, to extract
the correct outputs.
This intermediate stylesheet might contain code like this (not tested):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<!--
Default values are unlikely namespaces.
We'd need "output_ns" to possibly be a list of namespaces,
(I use [ns_1][ns_2] kind of strings, and split the string
up in the XSL), so that you could output HTML and DEBUG.
-->
<xsl:param name="logic_ns" select="'***'" />
<xsl:param name="output_ns" select="'***'" />
<xsl:variable name="xsl_ns"
select="'http://www.w3.org/1999/XSL/Transform'" />
<xsl:template match="*[namespace-uri(.) = $logic_ns]">
<!-- probably not the right way to do the following -->
<xsl:element name="local-name(.)" namespace="{$xsl_ns}">
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="*[namespace-uri(.) = $output_ns]">
<!-- strip namespace -->
<xsl:element name="local-name(.)">
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
A command line might look like this (where I've come up with a new
suffix) :
xslt-processor \
template_stylesheet.txsl \ # in
intermediate_stylesheet.xsl \ # transform
logic_ns='org.hedley.xsl_logic' \ # the logical choice!
output_ns='[org.hedley.html][org.hedley.xsl_trace]' \ # html + debug
> html_debug_processor.xsl # output
--
Warren Hedley
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list