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

Re: Need help skipping a child element

Subject: Re: Need help skipping a child element
From: "Fatbob" <fatbob73@xxxxxxxxxxx>
Date: Thu, 26 Mar 2009 13:29:58 -0400
Re:  Need help skipping a child element
Thanks for the quick reply Martin.

Maybe I should have included a snippet of my XSL.

I'm doing the following...

<fo:table-row keep-together.within-column="always">
 <xsl:for-each select="Cell">
  <xsl:call-template name="DataCell"/>
 </xsl:for-each>
</fo:table-row>

<xsl:template name="DataCell">
 <xsl:choose>
  <xsl:when test="@Status='Panic'">
   <fo:table-cell color="red" background-color="white" border="1pt solid
black" wrap-option="wrap" overflow="hidden">
    <fo:block font-size="10pt" padding="1mm" margin-left=".25mm"
overflow="hidden" language="ru" hyphenate="true">
     <xsl:value-of select="."/>
    </fo:block>
   </fo:table-cell>
  </xsl:when>
  <xsl:otherwise>
   <fo:table-cell color="black" background-color="white" border="1pt solid
black" wrap-option="wrap" overflow="hidden">
    <fo:block font-size="10pt" padding="1mm" margin-left=".25mm"
overflow="hidden" language="ru" hyphenate="true">
     <xsl:value-of select="."/>
    </fo:block>
   </fo:table-cell>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

I tried doing...

<xsl:for-each select="Cell[position() = (1,2,3,6,7)]">

but that doesn't work.

----- Original Message ----- 
From: "Martin Honnen" <Martin.Honnen@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, March 26, 2009 12:47 PM
Subject: Re:  Need help skipping a child element


> Fatbob wrote:
>
> > Using XSL, I need to be able to remove (by this I mean or not display)
> > certain child elements. For example I only want to display the 1st, 2nd,
> > 3rd, 6th and 7th, and always those elements only.
>
> Well XSL does not display elements, it only processes them. If in your
> template for the Row element you do e.g.
>    <xsl:template match="Row">
>      <xsl:apply-templates select="Cell[position() = (1,2,3,6,7)"/>
>    </xsl:template>
>
>    <xsl:template match="Cell">
>      <!-- output what you want to output -->
>    </xsl:template>
> then with XSLT 2.0 that should work to process only the listed Cell
> elements.
>
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/

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.