|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Sorting a delimited attribute
Hi Perry,
Assuming you have written the XSL for 1st part of
your requirement, the following XSL does grouping
based on Muenchian method -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:key name="by-tr" match="tr"
use="substring(td[1],1,1)"/>
<xsl:template match="/table">
<html>
<head>
<title/>
</head>
<body>
<xsl:for-each select="tr">
<xsl:if test="generate-id(.) =
generate-id(key('by-tr', substring(td[1],1,1))[1])">
<table>
<xsl:for-each select="key('by-tr',
substring(td[1],1,1))">
<tr>
<td>
<xsl:value-of select="td[1]"/>
</td>
<td>
<xsl:value-of select="td[2]"/>
</td>
<td>
<xsl:value-of select="td[3]"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Regards,
Mukul
--- perry.ielati@xxxxxxxxxxxx wrote:
> Hi all
>
> Newbie to the forum (and to XSL/T ) and i have a
> problem that i'm hoping
> someone can help me with.
>
> I have an XML attribute that is seperated by
> commas(,) and pipes(|). Here's a
> small sample...
>
>
CC_DESCRIPTION="D686,Work,1|E004,English,2|E005,English,2|E012,Media,1|E231,Busi
> ness Technology,1|E280,Applied
> Technology,1|E282,Technical Graphics,1| etc etc "
>
> What I need to do is create 2 HTML tables with each
> pipe(|) seperated set of
> values in a new row and each comma(,) seperated
> value in it's own cell.
>
> Ie..
>
> <table>
> <tr>
> <td>D686 (code)</td>
> <td>Work (title)</td>
> <td>1 (points)</td>
> </tr>
> <tr>
> <td>E004 (code)</td>
> <td>English (title)</td>
> <td>2 (points)</td>
> </tr>
> </table> etc etc
>
> I've done this, however, all the values are in 1
> table - what I need to do is
> now split the data - all codes starting with 'E'
> should be in a seperate table
> to those starting with 'E'.
>
> I'm completely baffled. Any help would be
> appreciated.
>
> BTW, I have no control over the layout of the
> XML...only the XSL.
>
> Thanks in advance,
> Perry
>
>
--+------------------------------------------------------------------
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to:
> http://lists.mulberrytech.com/xsl-list/
> or e-mail:
> <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








