[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: relative path from one node to another (XSLT 2.0

Subject: Re: relative path from one node to another (XSLT 2.0 solution)
From: JBryant@xxxxxxxxx
Date: Thu, 19 May 2005 14:23:58 -0500
xsl template relative path
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.