In my tests, your code produces exactly the output you are asking for.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Ed Yau [mailto:eyau(_at_)vstrading(_dot_)co(_dot_)uk]
Sent: 28 November 2008 14:50
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Saxon node matching order
Hi all,
I have a question about how Saxon chooses which node to match next.
I have some XML that looks a bit like this:
<x>
<y>
<z>Peter</z>
</y>
<z> </z>
<y>
<z>Jones</>
</y>
</x>
What I'm trying to achieve is the follow:
<x>
<z>Peter</z>
<z> </z>
<z>Jones</>
</x>
With the code below:
<xsl:template match="x" >
<xsl:apply-templates select="y|z"/>
</xsl:template>
<xsl:template match="y">
<xsl:apply-templates select="z"/>
</xsl:template>
<xsl:template match="z">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="@*|*">
<xsl:copy>
<xsl:apply-templates select="@*|node()">
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
But annoyingly my code seems to be doing this instead:
<x>
<z>Peter</z>
<z>Jones</z>
<z> </z>
</x>
It is obviously matching all the <y> tags before the <z> tags.
Does anyone know of a way around this?
Many thanks,
Ed
--
Vision Support Trading
Web Site - www.vstrading.co.uk
Registered Office: Beech House, Park West, Sealand Road,
Chester, CH1 4RJ REGISTERED IN ENGLAND AND WALES. COMPANY
NUMBER 3828782
Please note all electronic mail may be monitored.
The information contained in or attached to this email is
intended only for the use of the individual or entity to
which it is addressed. If you are not the intended recipient,
or a person responsible for delivering it to the intended
recipient, you are not authorised to and must not disclose,
copy, distribute, or retain this message or any part of it.
It may contain information which is confidential and/or
covered by legal professional or other privilege (or other
rules or laws with similar effect in jurisdictions outside
England and Wales). The views expressed in this email are not
necessarily the views of Vision Support Trading Ltd, and the
company, its directors, officers or employees make no
representation or accept any liability for its accuracy or
completeness unless expressly stated to the contrary.
--~------------------------------------------------------------------
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>
--~--