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

Re: gather all similar elements in different docs

Subject: Re: gather all similar elements in different docs
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 9 Jan 2009 16:49:58 -0500
 Re: gather all similar elements in different docs
ufff... nevermind. I needed to do:

<xsl:apply-templates select="$defs/*">


On Jan 9, 2009, at 4:48 PM, Robert Koberg wrote:


Hi, (using saxon9)

I have a few pages that each contain a table of definitions. The tables look like (they do not have a namespace):

 <table border="0" cellspacing="0">
     <tr>
        <td>
           <p>absenteeism</p>
        </td>
        <td>
           <p>frequent or habitual absence from school</p>
        </td>
     </tr>
....

Can I gather up all of the TR elements, like my defs variable below (or some other way) and apply-templates on them (while sorting)? The stylesheet below causes an error "Too many nested apply-templates calls. The stylesheet may be looping." at the <xsl:apply-templates select="$defs">

What am I doing wrong here?

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

<xsl:variable name="defs">
<xsl:copy-of select="doc('lsb/content/glossary-1.1.1.xml')//tr"/>
<xsl:copy-of select="doc('lsb/content/modules-1-glossary.xml')// tr"/>
<xsl:copy-of select="doc('lsb/content/modules-2-glossary.xml')// tr"/>
<xsl:copy-of select="doc('lsb/content/modules-3-glossary.xml')// tr"/>
<xsl:copy-of select="doc('lsb/content/modules-4-glossary.xml')// tr"/>
</xsl:variable>


 <xsl:template match="/">
   <glossentries>
     <xsl:apply-templates select="$defs">
       <xsl:sort select="normalize-space(td[1]/p/text())"/>
     </xsl:apply-templates>
   </glossentries>
 </xsl:template>

<xsl:template match="tr">
<xsl:variable name="term" select="normalize-space(td[1]/p/ text())"/>
<xsl:variable name="file-name" select="translate($term, ' ', '-')"/>
<glossentry file-name="{$file-name}">
<term>
<xsl:value-of select="$term"/>
</term>
<definition>
<xsl:copy-of select="td[2]/*"/>
</definition>
</glossentry>
</xsl:template>


</xsl:stylesheet>

thanks,
-Rob

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.