xsl-list
[Top] [All Lists]

Temporary Trees

2003-06-03 01:05:18
Hi all,

I am struggling to create and use temporary trees. The following generates
an error:

[Input]
<Folder>
        <File Name="File1" />   
        <File Name="File2" />
        <File Name="File3" />
        <File Name="File4" />
        <File Name="File5" />
</Folder>


[Stylesheet]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="xml" version="1.1" encoding="UTF-8"
indent="yes"/>

        <xsl:template match="Folder">
                <xsl:variable name="sorted-files">
                        <xsl:for-each select="File">
                                <File>
                                        <xsl:copy select="@*" />
                                </File>
                        </xsl:for-each>
                </xsl:variable>

                <xsl:for-each select="$sorted-files">
                        <xsl:value-of select="@Name" /> - <xsl:value-of
select="@Position" /><BR/>
                </xsl:for-each>
        </xsl:template>


        <xsl:template match="File">
                <File>
                        <xsl:copy select="@*" />
                        <xsl:attribute name="Position"><xsl:value-of
select="position()" /></xsl:attribute>
                </File>
        </xsl:template>

</xsl:stylesheet>


I'm using MSXML4 (SP2), and get the following error:

        Reference to variable or parameter 'sorted-files' must evaluate to a
node list.


I have tried several methods, all have failed. Above is just one of the ways
that I have tried. I know I must be doing something wrong, but what?

Thanks,


Kaine



PROACTIS Group Limited
Holtby Manor, Stamford Bridge Road, York, YO19 5LL
Tel +44 (0)1904 481999 Fax +44 (0)1904 481666
Visit us at www.proactis.com <http://www.proactis.com/> 

PROACTIS (r) - Control spend.  Streamline purchasing.

************************************************************
The information contained in this email is intended only for the individual
to whom it is addresses.  It may contain privileged and confidential
information.  If you have received this message in error or there are any
problems, please notify the sender immediately and delete the message from
your computer.  The unauthorised use, disclosure, copying or alteration of
this message is forbidden.  PROACTIS Group Limited will not be liable for
direct, special, indirect or consequential damage as a result of any virus
being passed on, or arising from alteration of the content of this message
by a third party.
************************************************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>