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

Temporary Trees and Parser Upgrades

Subject: Temporary Trees and Parser Upgrades
From: "Mark Shellenberger" <mshellenberger@xxxxxxxxx>
Date: Tue, 10 Apr 2007 18:09:58 -0400
 Temporary Trees and Parser Upgrades
XSLT Gurus,

I have the following stylesheet that  worked when parsing with Saxon
8.8.04 but no longer works with Saxon 8.9.  I  assume this is because
some aspect of either xsl:variable or document() was  tightened up to
the standard and my implementation was sub-standard. The final  goal
of this stylesheet is to take in a single lookup table containing file
pairs, combine the category element values of the category file with
the entire  content of the article in the pair.  The output would have
the category elements  as children of the categories element.  The
combined structure would be output  with the doi as the filename.
There will be one output file for each pair of  input documents
identified in the lookup table.

I imagine that this stylesheet is a  wonder of missed opportunities
and strangely used structures.  I'd appreciate  any constructive
comments you have on it.  But, since it worked in Saxon 8.8 and  I now
need to use Saxon 8.9, my major concern is figuring out why it no
longer  works.

I leave myself to your tender mercies.


xslt 2.0 file

<?xml version="1.0"  encoding="UTF-8"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   <xsl:output method="xml"  indent="yes"/>
   <xsl:template  match="//PAIR">

       <!-- Create variables to  hold documents pointed to from index.xml -->
       <xsl:variable  name="article" select="document(ARTICLE)"/>
       <xsl:variable  name="category" select="document(CAT)"/>

       <!-- Create temporary  tree with entire article and
descendents of the categories element  -->
       <xsl:variable  name="temp">
           <xsl:apply-templates  select="$article|$category//categories"/>

        <!-- Creates output  directories and filenames -->
       <xsl:variable  name="doi_filename">
select="substring-before($category//doi, '/')"/>
           <xsl:value-of  select="substring-after($category//doi,

       <!-- Output document with  doi as filename -->
       <xsl:result-document  href="$doi_filename">
           <xsl:apply-templates  select="$temp"/>

  <!-- output category elements  as children of
article-meta/categories element  -->
   <xsl:template  match="//article-meta//categories">

    <!-- Drop all category  elements -->
   <xsl:template  match="/categories"/>

    <!-- Identity Transform  -->
   <xsl:template  match="node()|@*">
           <xsl:apply-templates  select="@*"/>


                               <category>Jungle Gyms</category>
                                <category>Swing Sets</category>
                                <category>Monkey Bars</category>

Article1.xml <root doi="10.9999/0000000000000" type="journal"> <header> <journal-meta> <title>Journal of Playgrounds</title> <ISSN>0000-000x</ISSN> <volume>1</volume> <issue>4</issue> <date> <year>2003</year> <month>June</month> </date> <publication> <name>Me Enterprises</name> <location>Springfield, Simpson State</location> </publication> </journal-meta> <article-meta> <title>Playground Equipment</title> <subtitle>Alternative Methods and Conclusions</subtitle> <author> <person> <firstname>Bob</firstname> <middle>J.</middle> <surname>Smith</surname> <aff>University of Pennsylvania</aff> </person> </author> <startpage>98</startpage> <finishpage>119</finishpage> <categories/> </article-meta> </header> <body> </body> <references> </references> </root>

Current Thread


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.
First Name
Last Name
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.