Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Use of xsl:number, ignoring some elements

From: "Michael Kay" <mhk@--------->
To:
Date: 8/4/2004 8:06:00 AM
> 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'm afraid I'm having difficulty understanding the question. You must have
*some* way to know which elements you want to ignore!

> The main [Tamino query]
> 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/..)"/>

You hven't told us what $canal is!

>   <!-- take the entire "channel" from database -->
>      <xsl:variable name="createQuery"
> select="concat('retrieveCompleteChannel','?',channel=',$myId)"/>
>   <xsl:variable name="show" select="document($createQuery)"/>

You're retrieving another document from the database here, but you haven't
told us what's in it!
> 
>  <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>

You haven't told us what's in $show.
> 
> </xsl:template>
> 
> <xsl:template name="listing">
>  <!-- some formating params -->
>  <xsl:param name="toList" select="$default//completeChannel"/>

You haven't told us what's in $default.

>  <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

I don't understand the relationship of this output to your input. Where do
the numbers 2,4,5 (and 1,2,3) come from?

> 
> ps: If my Grammar makes the question difficult to understand, 
> I will try to
> clarify.

It's difficult to understand the question, but the problem is nothing to do
with your grammar, which is perfect!

Michael Kay


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent