xsl-list
[Top] [All Lists]

RE: Sorting unsorted elements based on their attributes

2003-06-04 10:09:06
Hi.

        <comments>
        <comment page="20030101">blah</comment>
        <comment page="20030207">blah</comment>
        <comment page="20011127">blah</comment>
        ...etc
        </comments>

        Each <comment> element has a page attribute, which contains a date
in
        format CCYYMMDD as shown above.

        I'm trying to use a XSL stylesheet to display these, or sort them if
you prefer that wording, into a year/month/day type format.

I think you can use the substring() function in a match attribute as part of
a valid XPath expression.

substring(string, start_position, length)

<xsl:key match="comment" use="comment/substring(@page, 1, 4)" /> 

That would select the unique years.  If all of your dates are the same you
can supply start points for the parts you need.

Hope that helps.
Erika

end



------------  Gateway EDI, Inc.  
---------------------------------------------------------------------------------------------------

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
you are not the intended addressee, or the person responsible for delivering it 
to them, you may not copy, forward, disclose or otherwise use it or any part of 
it in any way.  To do so may be unlawful.  If you receive this email by 
mistake, please advise the sender immediately and destroy all copies of the 
original message.


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



<Prev in Thread] Current Thread [Next in Thread>