I know that your example is not correct because your are closing a before closing b. I am not new to XML syntax. The problem is that my XML structure is not static. I am using a loop to generate it. I did javascript before and it would be possible to open a tag and close it after 20 iterations of the loop and then reopen it and close it again until I am done.
Let me explain my problem a little more. I have two levels of bookmarks like this:
<group1>
<item1 />
<item2 />
<item3 />
< .... />
<item25 />
</group1>
<group2>
<item26 />
<item27 />
</group2>
What I would like to do is to add a level of bookmark within group 1 and group 2 which would give me that:
<group1>
<subgroup1.1>
<item1 />
< ... />
<item20 />
</subgroup1.1>
<subgroup1.2>
<item21 />
<... />
<item25>
</subgroup1.2>
</group1>
<group2>
<subgroup2.1>
<item26 />
<item27 />
</subgroup2.1>
</group2>
If you look at my code, I am trying to open the "subgroup" bookmark tag before opening the bookmark tag for my "items". And I try to close the "subgroup" bookmark tag after I have processed 20 items. I understand that what I am trying to do is not possible because the XML is validated before the processing of the XSL. If only the result would be validated, everything would be fine.
I would like to know of an alternate way to get what I want.
Thanks for your help!
Sebastien Clermont
From: k.degrauw@axis.nl
To: xep-support@renderx.com
Subject: RE: [xep-support] Grouping bookmarks
Date: Mon, 10 Jul 2006 08:46:49 +0200
Sebastien,It is quite obvious what is wrong is that you cannot jump out of a <xsl:if> element.That is basic XML syntax.The following is not correct XML:<a><b></a></b>Check the W3C xml pages for information on wellformed-nessRegards, Kees-----Original Message-----I am trying to form groups of 20 bookmarks in my document. I have a document that can have from 1 to 1000 bookmarks and I want them to be grouped by 20. I tried the "<for-each-group>" tag but xep tells me that I can't use that tag in this part of the xsl.
From: owner-xep-support@renderx.com [mailto:owner-xep-support@renderx.com]On Behalf Of Sébastien CLERMONT
Sent: Friday, 07 July 2006 7:04 PM
To: xep-support@renderx.com
Subject: [xep-support] Grouping bookmarks
My rx:outline works fine but when I am trying to place <xsl:if> tags and put <xsl:bookmark> within those if tags, I get an XML validation exception because the bookmark tags are not closed (they are but in an other if).
If I replace "<!-- open group of 20 -->" by "<rx:bookmark ...>" and "<!-- close group of 20 -->" by "</rx:bookmark>" in my code below, I get the validation errors. What can I do?
----------- source code -----------------------
<rx:outline>
<xsl:for-each select="//compte">
<xsl:variable name="type">
<xsl:value-of select="ResourceBundle:getString($libelles, concat('docimgchq.pdf.contenu.libelle.cpt',@serco))"/>
<xsl:if test="@serco = '05'">
<xsl:value-of select="@serno"/>
</xsl:if>
</xsl:variable>
<rx:bookmark internal-destination="{$type}">
<rx:bookmark-label><xsl:value-of select="$type"/></rx:bookmark-label>
<xsl:for-each select="cheque">
<xsl:variable name="cle" select="concat(@datecomptable, @noref)"/>
<xsl:if test="(count(preceding::cheque)+1) mod 20 = 0">
<!-- open group of 20 -->
</xsl:if>
<rx:bookmark internal-destination="{$cle}">
<rx:bookmark-label><xsl:value-of select="@nocheque"/></rx:bookmark-label>
</rx:bookmark>
<xsl:if test="count(preceding::cheque) mod 20 = 19 or last cheque">
<!-- close group of 20 -->
</xsl:if>
</xsl:for-each>
</rx:bookmark>
</xsl:for-each>
</rx:outline>
----------- source code -----------------------
This archive was generated by hypermail 2.1.8 : Mon Jul 10 2006 - 07:14:00 PDT