|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Concatenating a nodeset (set of attributes)
In XSLT 2.0 this is quite straightforward.
If you provide a really wellformed xml, somebody may try to solve your
problem in XSLT 1.0.
In the meantime, do have a look at this solution -- a generic sort
with varying/statically-unknown number of sort keys:
http://www.biglist.com/lists/xsl-list/archives/200303/msg00007.htm
l
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
On 10/8/05, Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx> wrote:
> Hi all,
>
> Using XSLT 1.0
>
> I have a table of contents that is of the following (endtags abreviated):
>
> <TOC>
> <STRUC pos="3" title="sometitle"><STRUC pos="1" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="4" title="Another"></ </
> <STRUC pos="2" title="sometitle"><STRUC pos="1" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="2" title="Another"></ </
> <STRUC pos="2" title="sometitle"><STRUC pos="3" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="6" title="Another"></ </
> </TOC>
>
> The depth of the STRUC elements is arbitrary.
>
> <TOC>
> <STRUC pos="2" title="sometitle"><STRUC pos="1" title="Another"></ </
> <STRUC pos="2" title="sometitle"><STRUC pos="3" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="1" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="2" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="4" title="Another"></ </
> <STRUC pos="3" title="sometitle"><STRUC pos="6" title="Another"></ </
> </TOC>
>
> When I am at the TOC element, I want to process the top STRUC
> elements, sorting them in full depth.
>
> If I can concatenate all pos attributes, I will be able to do this.
> As far as I know, I cannot say:
> <xsl:sort select="concat(.//STRUC/@pos)" date-type="number"/>
>
> Is there some other way that I can achieve this? Does the following work?
> <xsl:sort select=".//STRUC/@pos" data-type="number"/>
>
> I have not tried sorting more complicated than on a single element or
> attribute, so I am a little unsure of the mechanics in this.
>
> Another problem is of course where @pos > 10. If I had full control, I
> could do something like:
> <xsl:sort select="translate(.//STRUC/@pos,'0','A')" data-type="text"/>
>
> Is this workable? If not, is there someway else that I can achieve this?
>
> I am doing a lot with the data, besides just sorting them, so it is
> not so clearcut as an identity transformation sorting each element.
>
> I hope help is possible :-)
>
> Regards,
> Ragulf Pickaxe :-)
|
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








