Re: [xsl] relative path from one node to another (XSLT 2.0 solution)

Subject: Re: [xsl] relative path from one node to another (XSLT 2.0 solution)
From: "Richard Lewis" <richardlewis@xxxxxxxxxxxxxx>
Date: Fri, 20 May 2005 09:19:52 +0100
This is a very elegant solution; thanks very much.

I wonder if you'd had any thoughts on the problem I described of
implementing a mechanism for linking from one output document to another
using a
<link section="tom">See Tom's page</link>
element in the source tree?

Such an element should transformed to an HTML <a> tag with the correct
'href' attribute to link from the output document in which it occurs to
the output document for the section with id 'tom'.

Cheers,
Richard
On Thu, 19 May 2005 14:23:58 -0500, JBryant@xxxxxxxxx said:
> So, of course, two seconds after I push the send button, the light dawns 
> about how to skip the delete.me junk. Since result-document will make the 
> directory as it makes the files, I can skip the step of explicitly 
> creating the directories. I'm having one of my more dim days, between
> this 
> and missing the need for the self:: axis earlier. Anyway, here's the 
> corrected stylesheet:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 
>   <!-- process the root -->
>   <xsl:template match="document">
>     <xsl:apply-templates>
>       <xsl:with-param name="path" select="'root'"/>
>     </xsl:apply-templates>
>   </xsl:template>
> 
>   <!-- process the directories -->
>   <xsl:template match="section[section/@display='page']">
>     <xsl:param name="path"/>
>     <xsl:apply-templates>
>       <xsl:with-param name="path" select="concat($path, '/', @id)"/>
>     </xsl:apply-templates>
>   </xsl:template>
> 
>   <!-- process the pages -->
>   <xsl:template 
> match="section[@display='page'][not(section/@display='page')]">
>     <xsl:param name="path"/>
>     <xsl:result-document href="{concat($path, '/', @id, '.xml')}">
>       <chunks>
>         <xsl:apply-templates/>
>       </chunks>
>     </xsl:result-document>
>   </xsl:template>
> 
>   <!-- process the inline sections -->
>   <xsl:template match="section[@display='inline']">
>     <content chunk="{@id}"/>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> Sorry about any confusion that may arise from double posting.
> 
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)

Current Thread