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

Re: xsl:variable

Subject: Re: xsl:variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 May 2000 17:12:13 +0100 (BST)
div xml variable
> After when we reach the pb element, I print the
> content of this global variable. I empty the content
> of the variable, and again back to the first step.

You can't do that as XSL variables do not change their values once
bound. I have already posted the solution to the problem that you
originally posed (selecting as far as the first element) but you just
changed the problem to selecting things between multiple pb
elements

In which case you want something like

<div type="chapter">
1<!-- Other tags -->
<pb/>
2<!-- Other tags -->
<pb/>
3<!-- Other tags -->
<pb/>
4<!-- Other tags -->
<pb/>
5
</div>




<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                >

<xsl:output method="xml" indent="yes"/>


<xsl:template match="div[@type='chapter']">
<xxxx>
<xsl:apply-templates select="node()[not(preceding-sibling::pb)]"/>
</xxxx>

<xsl:for-each select="pb">
<xxxx>
<xsl:variable name="x" select="1+count(preceding-sibling::pb)"/>
<xsl:apply-templates select="following-sibling::node()[count(preceding-sibling::pb)=$x]"/>
</xxxx>
</xsl:for-each>



</xsl:template>

</xsl:stylesheet>






bash-2.01$ xt div.xml div.xsl
<?xml version="1.0" encoding="utf-8"?>
<xxxx>
1
</xxxx>
<xxxx>
2
</xxxx>
<xxxx>
3
</xxxx>
<xxxx>
4
</xxxx>
<xxxx>
5
</xxxx>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.