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

gather all similar elements in different docs

Subject: gather all similar elements in different docs
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 9 Jan 2009 16:48:39 -0500
 gather all similar elements in different docs
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">
            <p>frequent or habitual absence from school</p>

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

<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}">
<xsl:value-of select="$term"/>
<xsl:copy-of select="td[2]/*"/>



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.