Error while trying to transform an XML using XSLT 1.0
Posted: Mon Jul 26, 2021 2:19 pm
Hello,
I'm trying to create a function that will check if a node value exists in given XML. If yes, I should write another node/value for the final XML.
This is part of my stylesheet
This is my XML that should be transformed using the XSLT
However, when I'm trying to apply the transformation, I'm getting this error ->
I tried some examples from the Internet that use a 'my' namespace but it seems that I cannot make them working.
Does someone have an idea what i'm missing or what's wrong with my stylesheet?
I'm trying to create a function that will check if a node value exists in given XML. If yes, I should write another node/value for the final XML.
This is part of my stylesheet
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:exsl="http://exslt.org/common"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:func="http://exslt.org/functions"
extension-element-prefixes="exsl func">
<!-- Format for output document -->
<xsl:output method="xml" indent="yes"/>
<func:function name="func:isfieldmandatory">
<xsl:param name="fields" select="''"/>
<xsl:param name="fieldName" select="''"/>
<xsl:param name="country" select="''"/>
<xsl:param name="nodeToCheck" select="."/>
<func:result select="'yes'"/>
</func:function>
<xsl:variable name="result" select="func:isfieldmandatory('', 'SomeMandatoryField')"/>
<!-- Find the ROOT element and data underneath it -->
<xsl:template match="ROOT">
<!-- Declare a variable for date -->
<xsl:param name="date">
<xsl:value-of select="timestamp"/>
</xsl:param>
<xsl:variable name="fields" select="FIELDS"/>
<!-- Other instructions -->
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="utf-16"?>
<ROOT>
<NODES>
<SOME_NODE></SOME_NODE>
......
</NODES>
<FIELDS>
<field>MandatoryField</field>
<field>NotMandatoryField</field>
<field>SomeMandatoryField</field>
<field>...</field>
</FIELDS>
</ROOT>
In OXYGEN, i'm using .NET 2.0 engine and XSLT version 1.0. I'm not supposed to use version 2.0 because the system that will use the stylesheet doesn't support it.XmlLab.nxslt.NXsltException: An error occurred while executing transformation: System.Xml.Xsl.XslTransformException: Cannot find the script or external object that implements prefix 'http://exslt.org/functions'.
I tried some examples from the Internet that use a 'my' namespace but it seems that I cannot make them working.
Does someone have an idea what i'm missing or what's wrong with my stylesheet?