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