[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Concatenating a nodeset (set of attributes)

Subject: Re: Concatenating a nodeset (set of attributes)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 9 Oct 2005 06:39:46 +1000
xslt concatenate nodes
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 :-)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.