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

RE: Is there any multiple if exression (not xsl:if) a

Subject: RE: Is there any multiple if exression (not xsl:if) available in xpath/xslt2 ?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 20 Jul 2006 11:09:43 +0100
xsl if not
You haven't shown your source code so it's hard to see where you're going
wrong.

If you do

<xsl:apply-templates select="section, ref, ack, app"/>

then the sections will be processed in that order, and position() used
within the relevant templates will give you consecutive numbering. Also
count(section|ref|ack|app) will give you the right total.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Karl [mailto:call14@xxxxxxxxx] 
> Sent: 20 July 2006 10:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Is there any multiple if exression (not 
> xsl:if) available in xpath/xslt2 ?
> 
> I have an xml having some 'n' number of <section>'s + 3 
> OPTIONAL elemts <ref>, <ack> and <app>, which must appear in 
> that order. 
> Though my actual reqmt is to generate html pages in that 
> names with links from every page, what in essence i would 
> prefer to get is
> 
> 1. section 1
> 2. section 2
> ...
> n. section n 
> n+1 ref
> n+2 ack
> n+3 app
> 
> The problem is if ref is not present, it will be n. section n
> n+1 ack
> n+2 app
> 
> or if ack not there
> n+1 ref
> n+2 app
> 
> and the combination can be anything as those 3 elemts are 
> optional. I can have many <xsl:if>s to find and get what i 
> want. But is there a elegant solution or expression (can be 
> even xslt 2/xpath 2) that will reduce multiple if stmts?
> 
> Also, i need to count Total num of pages. Is there any expr 
> like Total pages = <xsl:value of select"count(//section) + 
> if(ref) add 1 + if (ack) add 1 + if(app) add 1"/> 
> 
> Thanks
> karl
> 
> 
> 		
> ___________________________________________________________
> The all-new Yahoo! Mail goes wherever you go - free your 
> email address from your Internet provider. 
> http://uk.docs.yahoo.com/nowyoucan.html

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.