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

Re: AW: Translating roman numerals into integers with

Subject: Re: AW: Translating roman numerals into integers with XSLT 2.0
From: António Mota <xptm@xxxxxxx>
Date: Tue, 21 Dec 2004 17:25:31 +0000
roman num
That will go to *my* FAQ :)

Quoting Mukul Gandhi <mukul_gandhi@xxxxxxxxx>:

> Of course, the XSLT 2.0 stylesheet will not work with
> 1.0 processor.
>
> We need to write a different stylesheet for XSLT 1.0
> processors. The only change will be, that we need to
> write a named template instead of a xsl:function .. I
> am presenting below a XSLT 1.0 solution also..
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="text"/>
>
> <xsl:template match="/">
>   <xsl:call-template name="RomanToInteger">
>     <xsl:with-param name="roman_number" select="'XXI'"
> />
>     <xsl:with-param name="index" select="1" />
>   </xsl:call-template>
> </xsl:template>
>
> <xsl:template name="RomanToInteger">
>   <xsl:param name="roman_number" />
>   <xsl:param name="index" />
>   <xsl:variable name="temp">
>     <xsl:call-template name="toRoman">
>       <xsl:with-param name="value" select="$index" />
>
>     </xsl:call-template>
>   </xsl:variable>
>   <xsl:choose>
>     <xsl:when test="$temp = $roman_number">
>       <xsl:value-of select="$index" />
>     </xsl:when>
>     <xsl:otherwise>
>       <xsl:call-template name="RomanToInteger">
>         <xsl:with-param name="roman_number"
> select="$roman_number" />
>         <xsl:with-param name="index" select="$index +
> 1" />
>       </xsl:call-template>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
>
> <xsl:template name="toRoman">
>   <xsl:param name="value"/>
>   <xsl:number value="$value" format="I"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Regards,
> Mukul
>
> > > Von: Antsnio Mota [mailto:xptm@xxxxxxx]
> > > Gesendet: Dienstag, 21. Dezember 2004 17:05
> > > An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Betreff: Re:  Translating roman numerals into
> > integers
> > > with XSLT 2.0
> > >
> > > 1) It works only with XSLT 2.0 as the Subject
> > sugests or with 1.0 too?
> > >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Jazz up your holiday email with celebrity designs. Learn more.
> http://celebrity.mail.yahoo.com
>
>





O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt

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.