I am trying to process XML/XSL using XSLT. The XML and parts of XSL contains of prefixed namespaces. My understanding is that it is enough to have the namespace declaration(s) in XSL file.
The XML file must have namespace prefix, I do not have an option to just remove them as a solution since it changes the XML data structure.
I have tried with declaring the xbrli namespace in the XML file, but the error is the same as If I would exclude it in that file.
Problem: I do not find what is causing the error, thus cannot isolate the root cause.
Resources I used for troubleshooting:
Saxonica - Saxon documentation
Error after XSLT has processed:
Saxon-HE 10.5J from Saxonica
Java version 11.0.10
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
using class net.sf.saxon.tree.tiny.TinyBuilder
Error on line 3 column 13 of annual_report_example_3_xbrl_mini.xml:
SXXP0003 Error reported by XML parser: The prefix "xbrli" for element "xbrli:xbrl" is
not bound.: The prefix "xbrli" for element "xbrli:xbrl" is not bound.
org.xml.sax.SAXParseException; systemId: file:/Xxx; lineNumber: 3; columnNumber: 13; The prefix "xbrli" for element "xbrli:xbrl" is not bound.
XML file:
<?xml version="1.0" encoding="UTF-8" ?>
<xbrli:xbrl>
<se-cd-base:Country>Sweden</se-cd-base:Country>
</xbrli:xbrl>
XSL file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xbrli="http://www.example.org/area-2"
xmlns:se-cd-base="http://www.example.org/area-3"
xmlns:ix="http://www.example.org/area-4"
xmlns="http://www.w3.org/1999/xhtml"
>
<xsl:template match="/xbrli:xbrl">
<html>
<head>
<title>MyTitle</title>
</head>
<body>
<ix:nonNumeric name="se-cd-base:Country">
<xsl:value-of select="se-cd-base:Country"/>
</ix:nonNumeric>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Expected output
<html>
<head>
<title>MyTitle</title>
</head>
<body>
<ix:nonNumeric name="se-cd-base:Country">
Sweden
</ix:nonNumeric>
</body>
</html>