Error while trying to transform an XML using XSLT 1.0

Here should go questions about transforming XML with XSLT and FOP.
skoleva
Posts: 1
Joined: Mon Jul 26, 2021 1:54 pm

Error while trying to transform an XML using XSLT 1.0

Post by skoleva »

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

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>
This is my XML that should be transformed using the XSLT

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>
However, when I'm trying to apply the transformation, I'm getting this error ->
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'.
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.

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?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error while trying to transform an XML using XSLT 1.0

Post by Radu »

Hi,

I'm afraid we (the Oxygen team) are not familiar with .Net 1.0's support for XSLT functions, it seems it does not support them.
Maybe you can try to ask around on Stack Overflow or on a public XSLT users list, see if you find others who have worked more with .NET 1.0.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply