[xsl] Re: gather all similar elements in different docs

Subject: [xsl] Re: gather all similar elements in different docs
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 9 Jan 2009 16:49:58 -0500
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">
           <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