Subject: Re: [xsl] Unable to replace "/" From: Florent Georges <lists@xxxxxxxxxxxx> Date: Tue, 23 Dec 2008 12:45:34 +0100 (CET) |
Hi, xsl:for-each/xsl:sort does not change the value of the current item, it just defines the order in which the results are added to the result tree. If you want to modify the input and use that modif in both sorting and outputing, you can either: make the modif in both places, or having your for-each on the modified value: <xsl:for-each select="date/replace(...)"> <xsl:sort ... <xsl:value-of ... Regards, -- Florent Georges http://www.fgeorges.org/ "V.Ramkumar" wrote: > Hi list, > > Unable to replace /. Please see below and provide solutions. > > XSL: > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="2.0"> > <xsl:output omit-xml-declaration="yes"/> > > <xsl:template match="/"> > <xsl:apply-templates/> > </xsl:template> > > <xsl:template match="root"> > <xsl:for-each select="date"> > <xsl:sort > select="replace(concat(substring(.,7,2),substring(.,4,2),substring(.,1,2)),' > /','-')" order="ascending" data-type="text" /><xsl:copy-of > select="."/><xsl:text> </xsl:text> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > XML: > <?xml version="1.0" encoding="UTF-8"?> > <root> > <date>07/12/07</date> > <date>06/11/05</date> > <date>06/12/06</date> > <date>05/12/09</date> > <date>05/02/08</date> > </root> > > Expected O/P: > > <date>06-11-05</date> > <date>06-12-06</date> > <date>07-12-07</date> > <date>05-02-08</date> > <date>05-12-09</date> > > Regards, > Ramkumar.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to round 2 digt year , Andrew Welch | Thread | Re: [xsl] Problem with grouping sib, G. Ken Holman |
RE: [xsl] Unable to replace "/", V.Ramkumar | Date | [xsl] How to round 2 digt year to 4, V.Ramkumar |
Month |