I'm having trouble with XSLT and need help. I replaced my original post with this one.
I have an XML file with an empty element that I eventually want to expand using content from a second XML file. I am using the xsltproc
(XSLT 1.0) for my processing engine on Ubuntu.
I noticed the Identity Template is not copying the DOCTYPE from the input, if it is supposed to.
I created a simplified test input file and simplified XSLT file. I still cannot get the "genres" XSLT Template to do anything. I changed that template to remove the named element - but it does not do that.
New Input XML -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tellico PUBLIC '-//Robby Stephenson/DTD Tellico V11.0//EN' 'http://periapsis.org/tellico/dtd/v11/tellico.dtd'>
<tellico xmlns="http://periapsis.org/tellico/" syntaxVersion="11">
<collection title="My Videos" type="3">
<entry id="1002">
<title>Midsomer Murders -- Set 25</title>
<id>1002</id>
<comments>Includes bonus material</comments>
<year>2013</year>
<cover>file:///data/www/htdocs/videodb/cache/img/1002.jpg</cover>
<running-time>90</running-time>
<medium>DVD</medium>
<genres></genres>
<set>Yes</set>
<count>3</count>
<location>2</location>
</entry>
</collection>
</tellico>
New XSLT Transform file -
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- the identity template (copies your input verbatim) -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<!-- special templates only for things that need them -->
<xsl:template match="genres"/>
</xsl:stylesheet>
Process command:
xsltproc -o merged.xml --novalid Identity.xslt test-input-merge.xml
I have to use the --novalid option because the periapsis.org site is down at this time.
And the output I get is:
<?xml version="1.0"?>
<tellico xmlns="http://periapsis.org/tellico/" syntaxVersion="11">
<collection title="My Videos" type="3">
<entry id="1002">
<title>Midsomer Murders -- Set 25</title>
<id>1002</id>
<comments>Includes bonus material</comments>
<year>2013</year>
<cover>file:///data/www/htdocs/videodb/cache/img/1002.jpg</cover>
<running-time>90</running-time>
<medium>DVD</medium>
<genres/>
<set>Yes</set>
<count>3</count>
<location>2</location>
</entry>
</collection>
</tellico>
According to the XSLT transform, and my limited understanding - the "genres" element should have not been included in the output, but it is. This is just a test, for now, to try and figure out how to get the genres template to do something.
I hope this improves on my original post and someone sees what is wrong. Thanks to all for any help you can provide.