[xsl] conversion from xslt2.0 to xslt1.0

Subject: [xsl] conversion from xslt2.0 to xslt1.0
From: "TDarksword" <tdarksword@xxxxxxxxxxxx>
Date: Tue, 22 Jun 2004 16:30:18 +0100
I was given a piece of XSLT that uses Saxon to work. Unfortunately my
webhost doesnt support Java, but it does support PHP so I can use sablotron
but not saxon. What I thus need to do is convert the following piece of
XSLT2.0 to XSLT1.0.

<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0">
<xsl:output method="xml" indent='yes' encoding="utf-8"/>

<xsl:template match="server">
<xsl:variable name="servername" select="substring(@name,1,4)"/>
<xsl:variable name="filename"
select="concat('file:///','h:/inetpub/wwwroot/','serverdump_',$servername,'.
xml')"/>
<xsl:result-document href="{$filename}">
<resources>
<xsl:for-each
select=".//resource[not(@swgcraft_id=preceding::*/@swgcraft_id)]">
<xsl:sort select="."/>
<resource>
<xsl:attribute name="swgcraft_id" select="./@swgcraft_id"/>
<xsl:copy-of select="name"/>
<xsl:copy-of select="type"/>
<xsl:copy-of select="er"/>
<xsl:copy-of select="cr"/>
<xsl:copy-of select="cd"/>
<xsl:copy-of select="dr"/>
<xsl:copy-of select="fl"/>
<xsl:copy-of select="hr"/>
<xsl:copy-of select="ma"/>
<xsl:copy-of select="oq"/>
<xsl:copy-of select="sr"/>
<xsl:copy-of select="ut"/>
<xsl:copy-of select="pe"/>
<xsl:copy-of select="verified"/>
<xsl:copy-of select="available_timestamp"/>
<planets_on>
<xsl:variable name="resource" select="./@swgcraft_id" />
<xsl:for-each select="../../..//resource[@swgcraft_id=$resource]">
<xsl:value-of select="../../@name"/>
<xsl:if test="position()!=last()">
</xsl:if>
</xsl:for-each>
</planets_on>
</resource>
</xsl:for-each>
</resources>
</xsl:result-document>
</xsl:template>

</xsl:transform>

I'm guessing that as I can't use result-document, I'll need to do each
server 1 at a time, with parameters passed through from PHP to Sablotron,
unless anyone has any better ideas..


Current Thread