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

Re: Using for-each w/ page-sequence results in "NC105

Subject: Re: Using for-each w/ page-sequence results in "NC105 ID already exists in this document" error
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Sep 2007 16:48:05 +0100
Re:  Using for-each w/ page-sequence results in "NC105
On Thu, Sep 20 2007 14:56:29 +0100, Sharon_Harris@xxxxxxxxxxxxxxxxxxxx wrote:
> Before trying the for-each, I had all the page sequences contained within a
> template. I had 6 page sequences within that template that applied to 5
> different elements (cover, disclaimer, toc, introduction, lessons,
> evaluation). There are multiple instances of the Lesson element but the
> Lesson page sequence did not start over for each instance, which is why I
> tried using a for-each. I had the page sequences contained within the
> following template.
> <xsl:template match="/">
>       <fo:root>
>                   cover page sequence 1
>                   disclaimer page sequence 2
>                   toc page sequence 3
>                   introduction page sequence 4
>                   lessons page sequence 5 (contains <apply-templates
> select="//Lesson" mode="Activity"/ in the Body flow>
>                   evaluation page sequence 6
>       </fo:root>
> </xsl:template>
>
> Here is the code I used for the page sequences without the for-each.
> <xsl:template match="/">
>             <fo:root>
...
>                   <!--Start Lesson Section-->
>                   <fo:page-sequence master-reference="
> Chapter-SequenceOddEven">
...
>                   </fo:page-sequence>
>                   <!--End Lesson Section-->
...
>             </fo:root>
>       </xsl:template>
>       <!--End Evalution Section-->

1. Do any of your attribute sets include ID attributes?

2. Are lessons recursive, such that one lesson may contain another, so
   that the contained lesson is processed twice when you select
   "//Lesson"?

3. The advice from others for you to examine your output has been for
   you to run your input and stylesheet using an XSLT (not XSL-FO)
   processor -- e.g., xsltproc or Saxon -- and look at the XML output
   that it produces since that will include "id" attributes for the
   duplicated ID.

4. Instead of <xsl:for-each select="//Lesson">, you could do
   <xsl:apply-templates select="Lesson"> (i.e., something more specific
   than "//Lesson" because "//Lesson" looks for <Lesson> elements
   *everywhere*, including in the descendants of <Lesson>) and have a
   separate template for <Lesson>, e.g.:

      <xsl:template match="Lesson">
         <!--Start Lesson Section-->
         <fo:page-sequence master-reference="Chapter-SequenceOddEven">
            ...
         </fo:page-sequence>
         <!--End Lesson Section-->
      </xsl:template>

   That probably won't solve your duplicate ID problem since it's still
   likely that something is being processed twice, but it makes your "/"
   template a bit less monolithic.

Regards,


Tony Graham.
======================================================================
Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx   http://www.menteithconsulting.com

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
----------------------------------------------------------------------
Menteith Consulting -- Understanding how markup works
======================================================================

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.