xslt.new wrote:
So, in my xslt, I use:
<xsl:choose>
<xsl:when test="section='second section'>
<!-- Do not display thi section -->
</xsl:when>
</xsl:choose>
my output has:
1. first section
3. third section
4. fourth section
This is part of a huge issue that I am facing and so pasting the whole
XSLT here might be too cumbersome.
It is likely that your current approach is not the right xslt way of
doing things, since you talk of a lot of xsl:choose and of a 'huge'
structure. This tends to happen when people, coming from imperative
languages like C++, Java, VB, Perl, PHP have to think in declarative and
functional terms.
The easiest thing to do is: replace you xsl:choose with a (simpler)
xsl:template approach, like this:
<xsl:template match="section[. != 'second section']">
<!-- do display these sections -->
<xsl:number /> <!-- will only count the matches consecutively -->
</xsl:template>
<!-- probably you can leave this one out -->
<xsl:template match="scrion[.='second section']" />
Considering you are talking of a "huge" structure, it may so happen that
changing the choose-approach to a somewhat xslt-esquer approach lessens
your codebase by some percentage. Better yet, it will make it more
readable and it will leave calculating the best way to nirvana to the
processor, instead of you, the programmer, leaving you with more time to
do things like formatting numbers.
Can you give me any idea on how to number sequentially even if the
preceding or folowing siblings are filtered?
Sounds to me like you want something like this:
if (condition) add 1 to counter, print counter
However, this is not the way to go and assignment is not possible in XSLT.
Cheers,
-- Abel Braaksma
http://www.nuntia.nl
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--