[xslt] <copy-of> problems



I have an issue with the XLST library and <copy-of>

I have distilled my problem into a simple test.

Using the following xml file:

<?xml version="1.0" encoding="UTF-8"?>
<MD_Metadata xmlns="http://www.isotc211.org/2005/gmd">
  <language/>
  <characterSet/>
  </MD_Metadata>

and this stylesheet:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gmd="http://www.isotc211.org/2005/gmd" >
  <xsl:template match="/gmd:MD_Metadata">
     <xsl:copy-of select="@*|node()"/>
  </xsl:template>
  </xsl:stylesheet>

If I run xsltproc I get the result:

<?xml version="1.0"?>
  <language xmlns="http://www.isotc211.org/2005/gmd"/>
  <characterSet xmlns="http://www.isotc211.org/2005/gmd"/>


Whereas I was expecting the MD_Metadata root element to also be included. There is more information on this SO question (http://stackoverflow.com/questions/19915933/copy-of-xlst-tag-not-being-applied-consistently-in-different-processors) (and interestingly I don't get the <characterSet> tag in the first case when using lxml in python).

I assume this isn't a bug, but can anyone explain to someone who is quite green at this what is going on here?

Thanks

Stephen


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]