[xsl] Muenchian Grouping: Not coyping all elements

Subject: [xsl] Muenchian Grouping: Not coyping all elements
From: Sato_Alex@xxxxxxx
Date: Wed, 30 Aug 2006 13:12:43 -0400
I'm using Apache Software Foundation's http://xml.apache.org/xalan-j
I have a standard docbook book/chapter/refentry structure. I'm trying to
group the refentry elements into sections using the role attribute on each
refentry as the section/title--so the new structure would be
book/chapter/section/refentry. I have 2 chapters and the refentry id
attribute values begin with either "comp" for the "Components Reference"
chapter or "actn" for the "Actions Reference chapter--so I use "comp" and
"actn" to determine which chapter to put the refentry elements into.
The problem is that only 49 new sections are created, whereas there should
be 73. Also, the input file has be 2168, but the output file only has 1680
refentry elements. If I switch the positions of the chapters in the input
file, then the second one is still truncated.
Here's my stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">  <xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" doctype-public="-//Arbortext//DTD DocBook XML V4.0//EN"
doctype-system="axdocbook.dtd"/>  <xsl:key name="task-sections"
match="refentry" use="@role"/>  <xsl:template match="/">
  <xsl:element name="book">
   <xsl:apply-templates select="book/chapter"/>
 <xsl:template match="chapter">
   <xsl:variable name="id-first-string">
     <xsl:when test="title='Actions Reference'">
     <xsl:when test="title='Components Reference'">
  <xsl:element name="chapter">
   <xsl:copy-of select="title"/>
   <xsl:copy-of select="partintro"/>
select="refentry[generate-id()=generate-id(key('task-sections', @role)[1])
and starts-with(@id,$id-first-string)]">
    <xsl:element name="section">
     <xsl:element name="title">
       <xsl:when test="@role != 0">
        <xsl:value-of select="@role"/>
       <xsl:when test="@role = 0">
        <xsl:text>Need to be categorized</xsl:text>
      <xsl:copy-of select="."/>

Current Thread