RE: [xsl] List Item Query

Subject: RE: [xsl] List Item Query
From: "Sheryl Cia" <lyrehscg@xxxxxxxxxxx>
Date: Tue, 05 Mar 2002 06:39:12 +0000

Hi Joshua,


I've tried what you've stated below and it works.
However, i have another question.
How can i read the value inside '(' parenthesis?
When the value is either 'a' or 'i' i can properly render it as:
(a) Text 1....
(b) Text 1....
(c) Text 1....
or
(i) Text 1....
(ii) Text 1....
(iii) Text 1....

Please provide example. :)

Maybe your wondering where did i get such xml input.
Well, we've generate the xml based from the DTD.
And, as much as possible we do not want to change the DTD.

thanks for the help,
Sheryl


From: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] List Item Query
Date: Mon, 4 Mar 2002 17:03:18 +1100


Hi Sheryl,


If you have the assumption that the list type can be determined from the first list/item element, and secondly that if the item starts with '(' then it is an ordered list, otherwise it is an ordered list, you can try the following:

<xsl:template match="list">
 <xsl:choose>
  <xsl:when test="starts-with(item[1], '(')">
   <ol class="">
    <xsl:apply-templates select="item" mode="ol"/>
   </ol>
  </xsl:when>
  <xsl:otherwise>
   <ul>
    <xsl:apply-templates select="item" mode="ul"/>
   </ul>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template match="item" mode="ol">
 <li><xsl:value-of select="substring(., 5)"/></li>
</xsl:template>
<xsl:template match="item" mode="ul">
 <li><xsl:value-of select="substring(., 6)"/></li>
</xsl:template>

Hope that helps,
Joshua

------------------------------------------------------------------------------
This message and any attachment is confidential and may be privileged or otherwise protected from disclosure. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.






XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread