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

RE: Use of xsl:number, ignoring some elements

Subject: RE: Use of xsl:number, ignoring some elements
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 4 Aug 2004 09:04:40 +0100
name some elements
> 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

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.