Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2003, 05:39 AM
Registered User
 
Join Date: Nov 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default array to tree

   
Code:
 <xsl:variable name="root" select="/"/>
Code:
    <xsl:template match="/">
        <catalogo>
            <xsl:for-each select="fn:distinct-values(//autore)">
                   <autore>
                       <nome><xsl:copy-of select="."/></nome>
                    <xsl:variable name="nome" select="."/>
                       <xsl:copy-of select="$root/biblioteca/libro[autore=$nome]/titolo"/>
                   </autore>
              </xsl:for-each>
          </catalogo>
    </xsl:template>


wanna eliminate the
<xsl:for-each select="fn:distinct-values(//autore)">
is there a function to transform the array "fn:distinct-values(//autore)" to a tree, without using the for-each instrunction?

tnx :)

xslt learner :)
 
Old November 7th, 2003, 01:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to armmarti
Default

In XPath 2.0 sequence becomes the main construct. I couldn't find any function which "transforms" a sequence to a tree (look at http://www.w3.org/TR/xpath-functions/#d1e5620). And how can you imagine the arguments of that generic, hypothetical function which will "transform" any sequence to a tree(and how the structure of that destination tree will be given by arguments)? Definitely, you have to walk over the sequence and output the nodes you want, there is no other way.

Regards,
Armen
 
Old November 7th, 2003, 01:49 PM
Registered User
 
Join Date: Nov 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

tnx :)

xslt learner :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convering a String Array to an Integer array nkrust C# 9 November 17th, 2010 12:02 PM
Go from 2d Array to 1d array without defining type OneQuestion General .NET 1 January 10th, 2008 11:13 AM
traversing a tree based on an array of strings muki XSLT 1 February 16th, 2006 09:54 AM
error when sorting an Array of Array nancy VBScript 2 February 17th, 2005 12:57 PM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.