xsl-list
[Top] [All Lists]

Re: [xsl] Excluding an element with specific content from an <xsl:sort> call

2010-01-30 15:05:36
Thanks Ken,
But it did not work. I'll play around with some variations on that theme.
Mark

--------------------------------------------------
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Sent: Saturday, January 30, 2010 12:38 PM
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: Re: [xsl] Excluding an element with specific content from an <xsl:sort> call

At 2010-01-30 12:04 -0800, Mark Wilson wrote:
Is it possible when using <xsl:sort> to exclude elements with specific content from that <xsl:sort>call?

<xsl:sort> isn't a call of any kind ... it is considered a modifier of the select= of the parent instruction. The select= creates the population of elements to be processed and the <xsl:sort> instructions direct the ordering of the selected constructs.

In Listing 1, when the content of the element<Prefix> is 'A' , I would like to exclude that particular element from being sorted in the <xsl:sort select="Prefix" data-type="text" /> call. I cannot see how to use the "except" operator to do this. Is there a way to use "except" or some other filter?

Some input records will contain no <Prefix> element. However, when present, the <Prefix> element may content other than "A", such as "D", "L", etc. My goal is to sort input records with an <Prefix>A</Prefix> element as though it were absent from the record.

<xsl:sort select="if( Prefix='A' ) then '' else Prefix"/>

I hope this helps.

. . . . . . . . . . . . . Ken


--
UBL and Code List training:      Copenhagen, Denmark 2010-02-08/10
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--