XHTML transform gets unwnated attribute injected
XHTML transform gets unwnated attribute injected
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
Andreas
Re: XHTML transform gets unwnated attribute injected
Hi,
The general rule is that it gets bound to XHTML 1.0 or XHTML5(ePub3 schemas) depending on the DOCTYPE. If it is the simple <!DOCTYPE html> it gets bound to XHTML 5. It has a public or system ID, it uses that.
In your case, it shouldn't be bound to XHTML5. Switch to the XHTML document and look in the Properties view (Window > Show View > Properties) at the value of "Content completion". It should point to the xhtml1-strict.dtd from the xhtml framework resolved from the public/system ID.
Regards,
Adrian
XHTML isn't always bound to XHTML5/ePub3, but it may depend on the version of Oxygen. What version are you using (Help > About)?Why is XHTML being bound to Epub3 as a default?
The general rule is that it gets bound to XHTML 1.0 or XHTML5(ePub3 schemas) depending on the DOCTYPE. If it is the simple <!DOCTYPE html> it gets bound to XHTML 5. It has a public or system ID, it uses that.
In your case, it shouldn't be bound to XHTML5. Switch to the XHTML document and look in the Properties view (Window > Show View > Properties) at the value of "Content completion". It should point to the xhtml1-strict.dtd from the xhtml framework resolved from the public/system ID.
How can I configure Oxygen in a way, that it uses the document-type I have declared in the source-document?
In both cases it should already work with the default. Check the Properties view as instructed above for each case.How can I make sure, that XHTML5/ePub3 still gets validated with the right spec if I change the default?
This depends on a setting from the XSL processor Advanced options from the transformation scenario configuration (Document -> Transformation -> "Configure Transformation Scenario(s)", Edit). Press the "Advanced options" button (cogwheel icon) on the right of the Transformer combo and uncheck the option "Expand attribute defaults".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?
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Re: XHTML transform gets unwnated attribute injected
Hello Adrian,
thank you very much. Indeed, it was the "-expand" option in the processor settings. And you were right, the document has been linked to xhtml1-strict.dtd. Problem solved
thank you very much. Indeed, it was the "-expand" option in the processor settings. And you were right, the document has been linked to xhtml1-strict.dtd. Problem solved
Andreas
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service