XHTML transform gets unwnated attribute injected
Posted: Mon Mar 23, 2015 1:42 pm
The following (example only, don't try to find any sense in it) XHTML:
when processed with the following XSL-T (no sense in it either, just an example):
leads to the following error:
But I am also not understanding, why this happens at all? Why does the processor add attributes, that are not being in either of the two documents. It must have to do with the identity-copy, but this never ever happened to me before.
My questions therefore would be:
Andreas
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document Title</title>
</head>
<body>
<h3>Contents</h3>
<p><a href="#part1">Heading 2</a><br />
</p>
<hr />
<p><a id="part1" name="part1"></a></p>
<h2 id="ud74ab77b-6177-4a28-a22b-4a6a58a5c0f3">Heading 2</h2>
<p>para2</p>
<p>para 1</p>
</body>
</html>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
version="2.0">
<xsl:output
method="xhtml"
indent="yes"
encoding="UTF-8"
doctype-public="//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
cdata-section-elements="script style"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//a/@href">
<xsl:value-of select="generate-id()"/>
</xsl:template>
</xsl:stylesheet>
When I checked the document-type/framework configuration I realized, that XHTML is being associated with XHTML5/ePub3. I am confused.Saxon-EE 9.5.1.5
fatal:
XTDE0410: An attribute node (shape) cannot be created after a child of the containing element. Most recent element start tag was output at line 19 of module test.xsl
URL: http://www.w3.org/TR/xslt20/#err-XTDE0410
But I am also not understanding, why this happens at all? Why does the processor add attributes, that are not being in either of the two documents. It must have to do with the identity-copy, but this never ever happened to me before.
My questions therefore would be:
- Why is XHTML being bound to Epub3 as a default?
- How can I configure Oxygen in a way, that it uses the document-type I have declared in the source-document?
- How can I make sure, that XHTML5/ePub3 still gets validated with the right spec if I change the default?
- Why does an identity-copy inject attributes, that, while present in the schema, are not in either source document? And why does it only inject the "shape" attribute, but no others?
Andreas