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

Muenchian Grouping: Not coyping all elements

Subject: Muenchian Grouping: Not coyping all elements
From: Sato_Alex@xxxxxxx
Date: Wed, 30 Aug 2006 13:12:43 -0400
muenchian
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.
 
Thanks--Alex
 
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:element>
 </xsl:template>
 <xsl:template match="chapter">
   <xsl:variable name="id-first-string">
    <xsl:choose>
     <xsl:when test="title='Actions Reference'">
      <xsl:text>actn</xsl:text>
     </xsl:when>
     <xsl:when test="title='Components Reference'">
      <xsl:text>comp</xsl:text>
     </xsl:when>
    </xsl:choose>
   </xsl:variable>
  <xsl:element name="chapter">
   <xsl:copy-of select="title"/>
   <xsl:copy-of select="partintro"/>
   <xsl:for-each
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:choose>
       <xsl:when test="@role != 0">
        <xsl:value-of select="@role"/>
       </xsl:when>
       <xsl:when test="@role = 0">
        <xsl:text>Need to be categorized</xsl:text>
       </xsl:when>
      </xsl:choose>
     </xsl:element>
     <xsl:for-each
select="key('task-sections',@role)[starts-with(@id,$id-first-string)]">
      <xsl:copy-of select="."/>
     </xsl:for-each>
    </xsl:element>
   </xsl:for-each>
  </xsl:element>
 </xsl:template>
</xsl:stylesheet>

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.