xsl-list
[Top] [All Lists]

RE: [xsl] Is there any multiple if exression (not xsl:if) available in xpath/xslt2 ?

2006-07-20 03:09:58
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(_at_)yahoo(_dot_)com] 
Sent: 20 July 2006 10:50
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--