Subject: [xsl] Use of xsl:number, ignoring some elements From: "Marina Cuello" <cuello@xxxxxxxxxxxxxx> Date: Tue, 3 Aug 2004 17:57:38 -0300 |
Hi to all I'm new to this list and I'm starting with a question, as it couldn't be any other way ;) I want to make the xsl:number to "ignore" some elements while counting, but I don't have the way to know which the elements are so I can't put any selection on the "count" attribute. I've being looking for an answer to this problem but the only thing I've found are empty threads on forums and ignored or "no can't do" answers on lists. If you know a better way to achieve this, without xsl:number, I will be glad if you tell me, even if it's just a little hint. This is what I have. I'm working over the Tamino XML Server . The data in the base is a real "monster" collection; I can't change the data structure and I have to use the query-retrieving servlets that are available. The main I have is one that retrieves a HUGE XML document with a section like this one: <family> <siblings> <channelId>ch1</channelId> <channelId>ch2</channelId> </siblings> <children> <channelId>ch3</channelId> <channelId>ch4</channelId> <channelId>ch5</channelId> </children> </family> The templates that handle this piece go like this: <xsl:template match="family"> <!-- Some HTML formatting (blah blah)--> <xsl:apply-templates select=".//channelId"/> <!-- Some HTML formatting (blah blah)--> </xsl:template> <xsl:template match="channelId"> <xsl:variable name="myId" select="."/> <xsl:variable name="isA" select="name($canal/..)"/> <!-- take the entire "channel" from database --> <xsl:variable name="createQuery" select="concat('retrieveCompleteChannel','?',channel=',$myId)"/> <xsl:variable name="show" select="document($createQuery)"/> <xsl:call-template name="listing"> <!-- some formating params --> <xsl:with-param name="toList" select="$show//completeChannel"/> <xsl:with-param name="isA" select="$isA"/> </xsl:call-template> </xsl:template> <xsl:template name="listing"> <!-- some formating params --> <xsl:param name="toList" select="$default//completeChannel"/> <xsl:param name="isA" select="string('none')"/> <xsl:if test='count($toList/published)>0'> <!-- Some HTML formatting using isA --> <xsl:value-of select="$toList/desc"/> - <xsl:number/> <!-- show the number --> <!-- Some HTML formatting using isA --> </xsl:if> </xsl:template> The "listing" template is part of a library that's used everywhere on the system. I can change it only if it can be used in the rest of the templates (i.e. adding a param to indicate it's my template the one that's calling it). As an example output, let's say "ch1" and "ch3" complete channels has no elements inside, I would like to see on my output the following: Channel 2 - 1 Channel 4 - 2 Channel 5 - 3 There is any way to achieve this, no matter it is with xsl:number or not? Thanks in advance, Marina Cuello ps: If my Grammar makes the question difficult to understand, I will try to clarify.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Using xsl:namespace-alias, John Dawson | Thread | RE: [xsl] Use of xsl:number, ignori, Michael Kay |
Re: [xsl] Splitting string, Dimtre Novatchev | Date | RE: [xsl] XSLT: Get timestamp, Subbiah |
Month |