I'm trying to transform an ugly Lotus Notes database into a condensed XML file for loading into another product that only needs ~25% of the data. For some reason, my template matches only work for "/". What do I need to change in my XSLT to get it to actually start processing my document's node other than /?
Mark
Input:
[HTML]
<?xml version='1.0'?>
<!DOCTYPE database SYSTEM 'xmlschemas/domino_7_0.dtd'>
<database xmlns='http://www.lotus.com/dxl' version='7.0' ...>
<databaseinfo ...>
...
</databaseinfo>
<launchsettings>
...
</launchsettings>
<document form='SRMF'>
...
</document>
</database>
[/HTML]
XSLT:
[HTML]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE stylesheet
[
<!ENTITY newline "<xsl:text>
</xsl:text>">
]>
<xsl:stylesheet
version="2.0"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
encoding="utf-8"
indent="yes"
method="xml"
version="1.0"
/>
<xsl:template match="/">
&newline;<xsl:comment> /:
'<xsl:value-of select="name(child::node())"/>'
'<xsl:value-of select="name(child::node()/child::node()[6])"/>'
'<xsl:value-of select="name(database)"/>'
</xsl:comment>
&newline;<xsl:element name="lndb2swcm:database" namespace="http://takeyourpick.com/lndb2swcm">
<xsl:apply-templates select="database"/>
&newline;</xsl:element>
</xsl:template>
<xsl:template match="database">
<xsl:comment> Database </xsl:comment>
<xsl:apply-templates select="document"/>
</xsl:template>
<xsl:template match="document">
<xsl:comment> Document </xsl:comment>
</xsl:template>
</xsl:stylesheet>
[/HTML]
Command:
[HTML]
java -jar saxon8.jar testFile.xml lndb2swcm.xsl
[/HTML]
Output:
[HTML]
<?xml version="1.0" encoding="utf-8"?>
<!-- /:
'database'
'document'
''
-->
<lndb2swcm:database xmlns:lndb2swcm="http://takeyourpick.com/lndb2swcm">
</lndb2swcm:database>
[/HTML]