Transforming TEI P5 with customized XSL
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 13
- Joined: Wed Nov 02, 2005 1:39 am
Transforming TEI P5 with customized XSL
Hello,
I've generated TEI P5 files from the template included with oXygen. While I can transform them into html using the transformation scenario included with oXygen, which relies on TEI XSL stylesheets, I can't transform them with customized XSL stylesheets - the transformation is successful, but the stylesheet rules are not applied and I get only plain text output.
What could be wrong? Both the XML and the XSL validate, but the rules are just not applied. I've tried both Saxon and Xalan.
The TEI P5 file is wrapped in this structure:
My stylesheet looks basically like this:
Any suggestions? Thanks!
I've generated TEI P5 files from the template included with oXygen. While I can transform them into html using the transformation scenario included with oXygen, which relies on TEI XSL stylesheets, I can't transform them with customized XSL stylesheets - the transformation is successful, but the stylesheet rules are not applied and I get only plain text output.
What could be wrong? Both the XML and the XSL validate, but the rules are just not applied. I've tried both Saxon and Xalan.
The TEI P5 file is wrapped in this structure:
Code: Select all
<?oxygen RNGSchema="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="xml"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
...
</TEI>
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xd="http://www.pnp-software.com/XSLTdoc"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
xmlns:edate="http://exslt.org/dates-and-times"
xmlns:estr="http://exslt.org/strings"
xmlns:exsl="http://exslt.org/common"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:local="http://www.pantor.com/ns/local"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:teix="http://www.tei-c.org/ns/Examples"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
extension-element-prefixes="exsl estr edate"
exclude-result-prefixes="html xd exsl estr edate a fo local rng tei teix"
version="1.0">
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"></xsl:output>
<xsl:template match="TEI">
<html>
<head>
<link rel="stylesheet" href="skt.css" type="text/css"></link>
<title>
<xsl:value-of select="teiHeader/fileDesc/titleStmt/title"></xsl:value-of>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<!-- here follow all sorts of templates for generating the content of <body> -->
</xsl:stylesheet>
Any suggestions? Thanks!
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
One of the major changes in TEI P5 is that the elements belong to a namespace, that is "http://www.tei-c.org/ns/1.0". Your template matches TEI elements from no namespace while the document root TEI element belongs to the TEI P% namespace. Note that XPath 1.0 does not have a notion of default namespace so everything that does not have a prefix belongs to no namespace. You need to match on tei:TEI instead of TEI in your template and also add a prefix to any other element reference in XPath expressions that you may have in your stylesheet.
<xsl:template match="TEI">
-->
<xsl:template match="tei:TEI">
Best Regards,
George
One of the major changes in TEI P5 is that the elements belong to a namespace, that is "http://www.tei-c.org/ns/1.0". Your template matches TEI elements from no namespace while the document root TEI element belongs to the TEI P% namespace. Note that XPath 1.0 does not have a notion of default namespace so everything that does not have a prefix belongs to no namespace. You need to match on tei:TEI instead of TEI in your template and also add a prefix to any other element reference in XPath expressions that you may have in your stylesheet.
<xsl:template match="TEI">
-->
<xsl:template match="tei:TEI">
Best Regards,
George
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