Subject: [xsl] Sort problem From: Mick <mick@xxxxxxxxxxxx> Date: Mon, 5 Feb 2001 11:56:32 +0100 |
Hi all, I have the following problem when sorting a list of words. My xml is: <root> <line lineID="1"> <word wordID="1">ABC-</word> <word wordID="2">ABCD</word> </line> <line lineID="2"> <word wordID="1" type="end">DEF</word> <word wordID="2">XYZ</word> </line> </root> I have a stylesheet to create an alphabetical list of words. If a word contains a dash, it means it has to be joined with the following word that has an attribute type="end". The xsl I use is: <xsl:for-each select="root/line/word"> <xsl:sort select="."/> <xsl:choose> <xsl:when test="contains(., '-')"> <xsl:value-of select="substring-before(., '-')"/> <xsl:value-of select="following::word[@type='end']"/><br/> </xsl:when> <xsl:when test="@type='end'"></xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:for-each> The result is: ABCDEF ABCD XYZ which is not what I want because the alphabetical order is wrong. The xsl:sort only sorts on the 'substring-before' part ABC minus the dash) and ignores the 'following::word' bit (DEF). I want the output to be: ABCD ABCDEF XYZ How can I get the result of the 'substring-before' part and the 'following::word' part to be handled as one entity? I'm using IE and MSXML3. -mick XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Can I parameterise encodi, Michael Kay | Thread | Re: [xsl] Sort problem, Jeni Tennison |
Re: [xsl] Detecting presence of att, Peter Flynn | Date | Re: [xsl] Detecting presence of att, Dimitre Novatchev |
Month |