RE: [xsl] Generating an XSL from an XML

Subject: RE: [xsl] Generating an XSL from an XML
From: "bryan" <bry@xxxxxxxxxx>
Date: Tue, 14 May 2002 16:23:14 +0200
Remy wrote
>For examplee, i wanted to use an xml defining a format, and generate
the
>default xsl stylesheet able to parse an xml using that format into a
text
>file.
>I was inquisitive to know whether there were another option than using
a
><![CDATA section for every XSL instruction i wanted to generate, so
that >the parser didn't try to execute them.

Associate your xslt elements with another namespace prefix, as follows

<xsl:stylesheet 
    xmlns:asl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
      xmlns:xslt=http://www.some.com/xsl >

then you can say the following:
<xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>

<asl:template match="/">
	<xslt:stylesheet>
 <asl:apply-templates/></xslt:stylesheet>
</asl:template>
<asl:template match="params">
<asl:for-each select="p">
<xslt:param name="{.}" select="{@value}"/>
</asl:for-each>
</asl:template>

I like this because you can keep separate your stylesheet generating
stuff asl: from your stylesheet stuff xslt: 

Depending on your processor your output will either have all the xslt
changed to xsl, or you'll have something like this(in Saxon for example)

<xslt:stylesheet
 xmlns:xslt=" http://www.w3.org/1999/XSL/Transform"; version="1.0">
....and so forth





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread