|
Subject: Re: [xsl] Single transformation using XSLT on-the-fly From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> Date: Sat, 18 Oct 2008 20:39:50 +0100 |
>>>>> "Giacomo" == Giacomo <giacgbj@xxxxxxx> writes:
>> Well, it rather depends upon your definition of a single
>> transformation, and how much you are prepared to cheat.
Giacomo> When I said "a single transformation" I meant applying
Giacomo> the stylesheet only once. If the stylesheet is able to do
Giacomo> other transformations it's right for me.
>> But using an extension function means you aren't doing it in
>> pure XSLT 2.0. Well, you didn't say pure.
>>
>> Do you want an example?
Giacomo> Of course, I'm not pure ;)
Well, here is the example I just wrote.
Testing it found a bug (so you can't run it), but I fixed the bug,
locally. The output was:
<?xml etc. ?>
Tested OK.
Change the xsl:value-of to xsl:sequence prints the XML, instead of the
contents.
This is the transformation:
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gexslt="http://www.gobosoft.com/eiffel/gobo/gexslt/extension"
xmlns:axsl="file://namespace.alias"
version="2.0">
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
<xsl:template name="initial">
<xsl:call-template name="build"/>
<xsl:call-template name="run"/>
</xsl:template>
<xsl:template name="build">
<xsl:result-document href="file:///home/colin/gestalt/generated.xslt">
<axsl:transform version="2.0">
<axsl:template match="/">
<doc>
Tested OK.
</doc>
</axsl:template>
</axsl:transform>
</xsl:result-document>
</xsl:template>
<xsl:template name="run">
<xsl:variable name="generated" select="gexslt:transformation('file:///home/colin/gestalt/alias.xsl',doc('file:///home/colin/gestalt/system.xace'))"/>
<xsl:value-of select="$generated"/>
</xsl:template>
</xsl:transform>
This worked (after fixing the bug, which means you can't run it at
home), by first creating a symbolic link from
alias.xsl onto generated.xslt.
A real cheat.
--
Colin Adams
Preston Lancashire
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Single transformation usi, Giacomo | Thread | Re: [xsl] Single transformation usi, Colin Paul Adams |
| Re: [xsl] XML Namespaces and <xsl:o, Alejandro | Date | RE: [xsl] Single transformation usi, Michael Kay |
| Month |