This a follow-up from this stackoverflow question - Remove Duplicate Record from XML file using XLST
When using the online XSLT Test Tool (http://xslttest.appspot.com) the solution provided for this question works as expected. However when I implement the xslt into a shell script I receive the following error:
XPath error : Invalid expression
.[generate-id()=generate-id(key('DistinctEAN', @vchEAN)[1])]
^
compilation error: file titles_isbn.xsl line 15 element copy-of
xsl:copy-of : could not compile select expression '.[generate-id()=generate-id(key('DistinctEAN', @vchEAN)[1])]'
I do not understand why the xslt works fine when it is used in the XSLT Online Test Tool but not when it is used in a shell script format. Here is my shell script:
#!/bin/sh
echo "Renaissance Duplicate Filter Removal Script Start...."
cd /var/process/renaissance/scripts
xsltproc titles_isbn.xsl /var/process/renaissance/extractedfiles/titles_isbn_test.xml -o /var/process/renaissance/rrin/titles_isbn_nodup.xml
echo "Renaissance Duplicate Filter Removal Script complete"
Here is the titles_isbn.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="DistinctEAN" match="z:row" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="RowsetSchema" use="@vchEAN" />
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="z:row" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="RowsetSchema" >
<xsl:copy-of select=".[generate-id()=generate-id(key('DistinctEAN', @vchEAN)[1])]"/>
</xsl:template>
</xsl:stylesheet>
Any help would be much appreciated.
xsltprocversion supports?