Using the following XML:
<?xml version="1.0" encoding="UTF-8"?><FileService>
<Route>Reaper</Route>
<File>
<Filename>C:\datatrans\test\trans\outbound\texty1.txt</Filename>
</File>
<File>
<Filename>C:\datatrans\test\trans\outbound\texty2.txt</Filename>
</File>
</FileService>
And this XSL stylesheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
extension-element-prefixes="jbi"
xmlns:foo="http://servicemix.apache.org/demo/"
version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<xsl:choose>
<!-- Invoke the reaper service -->
<xsl:when test="FileService/Route='Reaper'">
<xsl:for-each select="FileService/File">
<jbi:invoke service="foo:FileReaper">
<jbi:copyProperties/>
<xsl:copy-of select="/"/>
</jbi:invoke>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<jbi:copyProperties/>
<jbi:forward service="foo:trace"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
I cannot seem to insert a node anywhere in the document.
Ideally I would like to insert a node just after the Route node, like so:
<?xml version="1.0" encoding="UTF-8"?>
<FileService>
<Route>Reaper</Route>
<InsertedNode>2</InsertedNode>
<File>
<Filename>C:\datatrans\test\trans\outbound\texty1.txt</Filename>
</File>
<File>
<Filename>C:\datatrans\test\trans\outbound\texty10.txt</Filename>
</File>
<File>
<Filename>C:\datatrans\test\trans\outbound\test1.doc</Filename>
</File>
</FileService>
I have tried using an <xsl:element tag but to no avail. It seems to just
disrupt the output and give me errors. But the XSL as it is now does work
without my inserted node so, is it the XalanExtension not working or more
likely what is the XSL to do it?
Regards Rick
Direct Line Group Limited, registered in England
with number 2811437, registered office 3 Edridge
Road, Croydon, Surrey CR9 1AG. The following
companies are members of the Direct Line Group:
Direct Line Insurance plc, Direct Line Life
Insurance Company Limited, Direct Line Unit
Trusts Limited and Direct Line Financial Services
Limited, all of which are authorised and regulated
by the Financial Services Authority. All are
members of The Royal Bank of Scotland Group.
This email is intended for the addressee only and
may contain confidential, proprietary or legally
privileged information. If you are not the
intended recipient of this email you should
notify us immediately and delete it. You should
not copy, print, distribute, disclose or use any
part of it. We reserve the right to monitor and
record all electronic communications through our
networks. We cannot accept any liability for
viruses transmitted via this e-mail once it has
left our networks.