xslt transformation does not function - no node recognized
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 1
- Joined: Thu Jul 10, 2014 6:36 pm
xslt transformation does not function - no node recognized
Hello OxygenXml Users
I experience a strange issue while trying to transform the xml data into html data via xslt
There is no node recognized; all text is displayd and not only the requested one.
Normally this solution worked before; maybe I activated an option in oxygenxml which precludes this operation.
Here is an extract of my xml file
Here is the xsl file:
Maybe you can have a quick look and give me a direction where I should search for the error?
Thanks for assistance
best regards
Franz
I experience a strange issue while trying to transform the xml data into html data via xslt
There is no node recognized; all text is displayd and not only the requested one.
Normally this solution worked before; maybe I activated an option in oxygenxml which precludes this operation.
Here is an extract of my xml file
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<ONIXMessage xmlns="http://ns.editeur.org/onix/3.0/reference"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.editeur.org/onix/3.0/reference ../ONIX_BookProduct_XSD_schema+codes_Issue_23/ONIX_BookProduct_3.0_reference.xsd"
release="3.0">
<Header>
<Sender>
<SenderIdentifier>
<SenderIDType>01</SenderIDType>
<IDValue>01</IDValue>
</SenderIdentifier>
<SenderName>Édition Arrowhead</SenderName>
<ContactName>Frank Fischer, +33-622-945-769</ContactName>
<EmailAddress>ffischer002@gmail.com</EmailAddress>
</Sender>
<Addressee>
<AddresseeName>Amazon EU S.a.r.L.</AddresseeName>
</Addressee>
<MessageNumber>782</MessageNumber>
<SentDateTime>20140707T0750-0500</SentDateTime>
<MessageNote language="ger">Buchdaten</MessageNote>
<DefaultLanguageOfText>ger</DefaultLanguageOfText>
</Header>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:strip-space elements="*"/> -->
<xsl:output method="html"/>
<xsl:template match="Header">
<html>
<body>
<h2>My Book Collection</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="Addressee">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="AddresseeName">
<xsl:value-of select="."/>
</xsl:template>
Thanks for assistance
best regards
Franz
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: xslt transformation does not function - no node recogniz
Hi,
This is a namespace problem. Your XML declares a default namespace (xmlns="http://ns.editeur.org/onix/3.0/reference"). However, your stylesheet does not take the namespace into account and simply tries to match elements from no namespace (e.g. Header).
I'm not sure how this worked before, Oxygen does not have an option for ignoring the namespace for transformations.
For XSLT 2.0 this would be really simple to resolve by specifying on the stylesheet root the attribute
xpath-default-namespace="http://ns.editeur.org/onix/3.0/reference".
For XSLT 1.0 you need to manually modify all the XPaths from matches/selects to indicate that they can be from any namespace, or you can make it specific:
e.g. (any namespace)
e.g. (specific namespace)
Regards,
Adrian
This is a namespace problem. Your XML declares a default namespace (xmlns="http://ns.editeur.org/onix/3.0/reference"). However, your stylesheet does not take the namespace into account and simply tries to match elements from no namespace (e.g. Header).
I'm not sure how this worked before, Oxygen does not have an option for ignoring the namespace for transformations.
For XSLT 2.0 this would be really simple to resolve by specifying on the stylesheet root the attribute
xpath-default-namespace="http://ns.editeur.org/onix/3.0/reference".
For XSLT 1.0 you need to manually modify all the XPaths from matches/selects to indicate that they can be from any namespace, or you can make it specific:
e.g. (any namespace)
Code: Select all
...
<xsl:template match="*:Header">
...
Code: Select all
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://ns.editeur.org/onix/3.0/reference"
exclude-result-prefixes="ns">
...
<xsl:template match="ns:Header">
...
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
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