Subject: Re: [xsl] Why Are My Tunnel Parameters Not Working? From: Eliot Kimber <ekimber@xxxxxxxxxxxx> Date: Thu, 06 Mar 2008 09:20:38 -0600 |
On 06/03/2008, Eliot Kimber <ekimber@xxxxxxxxxxxx> wrote:Can someone tell me what stupid thing I'm doing?
I glanced over it but it was also a bit too long and messy to make it easy to follow what was going on... maybe reduce it down and repost? Even in the unlikely event it did turn out to be a problem with Saxon, you could'nt exactly submit that as code to reproduce the problem...
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:param name="outdir" as="xs:string" required="yes"/> <xsl:variable name="outdirVar" select="if (ends-with($outdir, '/')) then $outdir else concat($outdir, '/')" as="xs:string"/>
<xsl:template match="/"> <xsl:apply-templates> <xsl:with-param name="baseOutDir" select="$outdirVar" tunnel="yes" as="xs:string"/> </xsl:apply-templates> </xsl:template>
<xsl:template match="topicref[@href]"> <xsl:param name="baseOutDir" tunnel="yes" as="xs:string" required="yes"/> <xsl:variable name="targetUrl" select="@href" as="xs:string"/> <xsl:variable name="targetDoc" select="document($targetUrl, .)" as="document-node()?"/> <xsl:variable name="resultUrl" select="concat($baseOutDir, @href)" as="xs:string"/> <xsl:variable name="pathTokens" select="tokenize($resultUrl, '/')[position() < last()]"/> <xsl:variable name="newBase" select="concat(string-join($pathTokens, '/'), '/')" as="xs:string"/> <xsl:result-document href="{$resultUrl}"> <xsl:apply-templates select="$targetDoc"> <xsl:with-param name="baseOutDir" select="$newBase" tunnel="yes" as="xs:string"/> </xsl:apply-templates> </xsl:result-document> <xsl:copy> <xsl:apply-templates select="(@*, node())"/> </xsl:copy> </xsl:template>
<xsl:template match="@*"> <xsl:copy/> </xsl:template>
<xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="(@*, node())"/> </xsl:copy> </xsl:template>
-- Eliot Kimber Senior Solutions Architect "Bringing Strategy, Content, and Technology Together" Main: 610.631.6770 www.reallysi.com www.rsuitecms.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Why Are My Tunnel Paramet, Andrew Welch | Thread | Re: [xsl] Why Are My Tunnel Paramet, Florent Georges |
Re: [xsl] Why Are My Tunnel Paramet, Andrew Welch | Date | Re: [xsl] two-level grouping, Martin Honnen |
Month |