Project

Profile

Help

Support #6604

closed

SXST0001 Error Code

Added by Nejdet Cemal Celik 17 days ago. Updated 9 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
.NET API
Sprint/Milestone:
-
Start date:
2024-12-06
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET

Description

Hi,

This is my first time creating a thread here. Hope i am not doing something wrong :) My problem is, when i try to run a schematron validation with compiled schematron file by schxslt, i am receiving an error like "Errors were reported during JIT compilation of template rule with match="/edefter:defter/xbrli:xbrl/gl-cor:accountingEntries"" And when i deep dive into stack trace, i get the "SXST0001" error code. Actually, i have found the issue. Problem is, the service which is provided the schematron file to us has added a local function in schematron file. And they have imported "fct" namespace on root element of sch. Then when a rule tries to call this local function, it causes an error. When i comment out the calling snippet, everything works fine. Is this problem causes by saxon or schxslt, i couldn't found a way. By the way, if i am opening this question on wrong place, can you please guide me where to ask this one?

--Importing 

<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fct="localFunctions" queryBinding="xslt2">
	<ns prefix="gl-plt" uri="http://www.xbrl.org/int/gl/plt/2010-04-16"/>
	<ns prefix="gl-cor" uri="http://www.xbrl.org/int/gl/cor/2006-10-25"/>
	<ns prefix="gl-bus" uri="http://www.xbrl.org/int/gl/bus/2006-10-25"/>
	<ns prefix="gl-muc" uri="http://www.xbrl.org/int/gl/muc/2006-10-25"/>
	<ns prefix="xbrli" uri="http://www.xbrl.org/2003/instance"/>
	<ns prefix="ds" uri="http://www.w3.org/2000/09/xmldsig#"/>
	<ns prefix="xades" uri="http://uri.etsi.org/01903/v1.3.2#"/>
	<ns prefix="edefter" uri="http://www.edefter.gov.tr"/>
	<ns prefix="fct" uri="localFunctions"/>

	<ns prefix="defterek" uri="http://www.edefter.gov.tr/ek"/>

--Function definition
``<xsl:function name="fct:isSorted" as="xs:boolean">
		<xsl:param name="accoundMainIdList" as="xs:string*"/>
		<xsl:variable name="sortedAccountMainIdList" as="xs:string*">
			<xsl:for-each select="$accoundMainIdList">
				<xsl:sort/>
				<xsl:value-of select="."/>
			</xsl:for-each>
		</xsl:variable>
		<xsl:variable name="s1">
			<xsl:value-of select="string-join($accoundMainIdList,'|')"/>
		</xsl:variable>
		<xsl:variable name="s2">
			<xsl:value-of select="string-join($sortedAccountMainIdList,'|')"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$s1 = $s2">
				<xsl:value-of select="true()"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="false()"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:function>``

--Function Calling Pattern

```<pattern id="accountingentries">

		<rule context="/edefter:defter/xbrli:xbrl/gl-cor:accountingEntries">
			<assert test="gl-cor:documentInfo">gl-cor:documentInfo zorunlu bir elemandır.</assert>
			<assert test="gl-cor:entityInformation">gl-cor:entityInformation zorunlu bir elemandır.</assert>
			<let name="accoundMainIdList" value="gl-cor:entryHeader/gl-cor:entryDetail[1]/gl-cor:account/normalize-space(gl-cor:accountMainID)"/>
			--This is the place that causes an error.<assert test="fct:isSorted($accoundMainIdList)">Büyük defterde hesaplar, ana hesap numarası bazında sıralı olmalıdır.</assert>

			<let name="altHesabiOlmayanAnaHesapListesi" value="gl-cor:entryHeader/gl-cor:entryDetail[1]/gl-cor:account[count(gl-cor:accountSub)=0]/normalize-space(gl-cor:accountMainID)"/>
			<let name="altHesabiOlmayanAnaHesapSayisi" value="count($altHesabiOlmayanAnaHesapListesi)"/>
			<let name="farkliAltHesabiOlmayanAnaHesapSayisi" value="count(distinct-values($altHesabiOlmayanAnaHesapListesi))"/>
			<assert test="$altHesabiOlmayanAnaHesapSayisi = $farkliAltHesabiOlmayanAnaHesapSayisi">Alt hesabı olmayan aynı hesaplar aynı gl-cor:entryHeader elemanı içerisinde bulunmalıdır.</assert>
			<let name="altHesapListesi" value="gl-cor:entryHeader/gl-cor:entryDetail[1]/gl-cor:account/gl-cor:accountSub/normalize-space(gl-cor:accountSubID)"/>
			<let name="altHesapSayisi" value="count($altHesapListesi)"/>
			<let name="farkliAltHesapSayisi" value="count(distinct-values($altHesapListesi))"/>
			<assert test="$altHesapSayisi = $farkliAltHesapSayisi">Aynı alt hesaplar aynı gl-cor:entryHeader elemanı içerisinde bulunmalıdır.</assert>
		</rule>
	</pattern>``

-- Compiled rule by schxslt

``
<xsl:if test="not(fct:isSorted($accoundMainIdList))"> 
                  <svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
                                      location="{schxslt:location(.)}">
                     <xsl:attribute name="test">fct:isSorted($accoundMainIdList)</xsl:attribute>
                     <svrl:text>Büyük defterde hesaplar, ana hesap numarası bazında sıralı olmalıdır.</svrl:text>
                  </svrl:failed-assert>
               </xsl:if>

Files

kebirschematron.xslt (132 KB) kebirschematron.xslt Nejdet Cemal Celik, 2024-12-06 19:53

Please register to edit this issue

Also available in: Atom PDF