XPath in Oxygen will not parse a document with a shema
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 4
- Joined: Mon Sep 10, 2007 10:31 pm
XPath in Oxygen will not parse a document with a shema
In my XML document the parser for XPath version 1.0 i.e. Sax6.5.5 works fine if your root document has this type of format:
<odva_cip_output_root>
However as soon as you add a schema and a namespace to this the XPath ceases to parse or find correct XML tags at all!
<odva_cip_output_root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.odva.org/schemas/ODVAcip.xsd"
xsi:schemaLocation="http://www.odva.org/schemas/ODVAcip ODVAoutput.xsd">
I need XPath and the parser for transformations to work with a schema and name space defined. Any ideas what is going on?
Regards,
Freemon
<odva_cip_output_root>
However as soon as you add a schema and a namespace to this the XPath ceases to parse or find correct XML tags at all!
<odva_cip_output_root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.odva.org/schemas/ODVAcip.xsd"
xsi:schemaLocation="http://www.odva.org/schemas/ODVAcip ODVAoutput.xsd">
I need XPath and the parser for transformations to work with a schema and name space defined. Any ideas what is going on?
Regards,
Freemon
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
This is a common issue that people encounter when they are using XPath with documents that contain default namespace declarations. The name tests without a prefix test for elements in no namespace. To test for elements in a namespace you need to declare the namespace bound to some prefix and use that prefix to qualify the element names.
See also:
http://www.oxygenxml.com/forum/ftopic18 ... +namespace
http://www.oxygenxml.com/forum/ftopic15 ... +namespace
http://www.oxygenxml.com/forum/ftopic12 ... +namespace
http://www.oxygenxml.com/forum/ftopic11 ... +namespace
http://www.oxygenxml.com/forum/ftopic24 ... +namespace
Regards,
George
This is a common issue that people encounter when they are using XPath with documents that contain default namespace declarations. The name tests without a prefix test for elements in no namespace. To test for elements in a namespace you need to declare the namespace bound to some prefix and use that prefix to qualify the element names.
See also:
http://www.oxygenxml.com/forum/ftopic18 ... +namespace
http://www.oxygenxml.com/forum/ftopic15 ... +namespace
http://www.oxygenxml.com/forum/ftopic12 ... +namespace
http://www.oxygenxml.com/forum/ftopic11 ... +namespace
http://www.oxygenxml.com/forum/ftopic24 ... +namespace
Regards,
George
George Cristian Bina
-
- Posts: 4
- Joined: Mon Sep 10, 2007 10:31 pm
Sorry my igorance
Hi George,
My StyleSheet Code is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<!-- HTML layout with template call to various parsings -->
<xsl:template match="/">
<html>
<body>
<center><h1>Ethernet I/P Performance Test Results</h1></center>
<xsl:apply-templates select="//ethernet_ip_device_communication_report" mode="Match_ALL"/>
</body>
</html>
</xsl:template>
<!-- Main template called to parse everything -->
<xsl:template match="device_information" mode="Match_ALL">
<h2>Device Information </h2> <br/>
<b>Manufacturer </b> <u><xsl:value-of select="manufacturer"/> </u><br/>
<b>Device Name </b> <u><xsl:value-of select="product_name"/> </u><br/>
<b>Model Number </b> <u><xsl:value-of select="serial_number"/> </u><br/>
<b>Short Description </b> <u><xsl:value-of select="product_name"/> </u><br/>
<b>Firmware Version </b> <u><xsl:value-of select="major_revision"/> </u><br/>
</xsl:template>
</xsl:stylesheet>
My XML code partial is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ODVAoutput.xsl"?>
<odva_cip_output_root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.odva.org/schemas/ODVAcip.xsd"
xsi:schemaLocation="http://www.odva.org/schemas/ODVAcip ODVAoutput.xsd">
<ethernet_ip_device_communication_report>
<device_information>
<vendor_id>23422</vendor_id>
<manufacturer>Acme Widgets, Inc.</manufacturer>
<device_type>12</device_type>
<product_code>3000</product_code>
<major_revision>1</major_revision>
<minor_revision>1</minor_revision>
<serial_number>W3000-01-001</serial_number>
<product_name>Distributed I/O Block</product_name>
</device_information>
I am not certain where the prefix needs to be for the parser to recognize the XML tag names with regards to a prefix namespace.
Regards,
Freemon
My StyleSheet Code is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<!-- HTML layout with template call to various parsings -->
<xsl:template match="/">
<html>
<body>
<center><h1>Ethernet I/P Performance Test Results</h1></center>
<xsl:apply-templates select="//ethernet_ip_device_communication_report" mode="Match_ALL"/>
</body>
</html>
</xsl:template>
<!-- Main template called to parse everything -->
<xsl:template match="device_information" mode="Match_ALL">
<h2>Device Information </h2> <br/>
<b>Manufacturer </b> <u><xsl:value-of select="manufacturer"/> </u><br/>
<b>Device Name </b> <u><xsl:value-of select="product_name"/> </u><br/>
<b>Model Number </b> <u><xsl:value-of select="serial_number"/> </u><br/>
<b>Short Description </b> <u><xsl:value-of select="product_name"/> </u><br/>
<b>Firmware Version </b> <u><xsl:value-of select="major_revision"/> </u><br/>
</xsl:template>
</xsl:stylesheet>
My XML code partial is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ODVAoutput.xsl"?>
<odva_cip_output_root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.odva.org/schemas/ODVAcip.xsd"
xsi:schemaLocation="http://www.odva.org/schemas/ODVAcip ODVAoutput.xsd">
<ethernet_ip_device_communication_report>
<device_information>
<vendor_id>23422</vendor_id>
<manufacturer>Acme Widgets, Inc.</manufacturer>
<device_type>12</device_type>
<product_code>3000</product_code>
<major_revision>1</major_revision>
<minor_revision>1</minor_revision>
<serial_number>W3000-01-001</serial_number>
<product_name>Distributed I/O Block</product_name>
</device_information>
I am not certain where the prefix needs to be for the parser to recognize the XML tag names with regards to a prefix namespace.
Regards,
Freemon
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