On 18 March 2010 10:12, Jacobus Reyneke <jacobusreyneke(_at_)gmail(_dot_)com>
wrote:
Good day,
This is a low priority request, but if someone has the time, please have a
look.
I have an XML document that outputs to XSL-FO using XSL 2.0. All was
well and happy until I tried to move all my notes in the XML file into
an Appendix (they currently appear structurally in the same place on
input and output). It's now a whole bottle or red wine later, but I
still don't have the answer (pleeshh helpsh me)
I'm trying to change this:
<root>
<a>
<note>aaaa</note>
<b>
<note>bbbbb</note>
</b>
<c>
<note>cccc</note>
</c>
</a>
</root>
Into:
<root>
<a>
<b>
</b>
<c>
</c>
</a>
<note>aaaa</note>
<note>bbbbb</note>
<note>cccc</note>
</root>
Here comes the difficult part: How can I change the following style
sheet to do the re-shuffling without touching the first three
templates. Currently input and output structure is the same. Now I
need to grab the 'notes' and put them in one place but without
affecting the rest of my xslt.
<xsl:template match="a">
........
</xsl:template>
<xsl:template match="b">
........
</xsl:template>
<xsl:template match="c">
........
</xsl:template>
<xsl:template match="note">
........
</xsl:template>
you need:
<xsl:template match="note"/>
and:
<xsl:template match="root">
<xsl:apply-templates/>
<xsl:copy-of select="//note"/>
</xsl:template>
If you need to process note elements rather than just copy them, then
apply-templates to them using a mode, and add that mode to your
existing note matching template.
cheers
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
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>
--~--