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
Actions #1

Updated by Michael Kay 17 days ago

The SXST0001 should be a supplementary message: it's an exception message indicating that the real underlying errors have been reported to the ErrorReporter - which for some reason appears to be putting them somewhere that isn't visible to you.

I can't see what the real syntax error is without seeing the XSLT code that the schematron processor has generated; it would appear to be incorrect, but we're not schematron experts here. If you post the full XSLT code then we can tell you what's wrong with it, but we can't tell you how schematron came to generate it.

For the missing error messages, we need to look at the way the transformation is being run to see why the error messages are disappearing. That will have nothing to do with the XSLT code itself, it will be something to do with the script or application that is invoking the transformation and controlling how it is run.

Actions #2

Updated by Nejdet Cemal Celik 17 days ago

My bad. I have attached the xslt that schxslt generated.

Actions #3

Updated by Nejdet Cemal Celik 17 days ago

Okay. Found the solution. In case anyone will face this issue, i am texting the solution.

In XSLT2, ISO spec says that functions must be declared before patterns. My function were located after patterns. Now i have replaced it and everything is going smooth. Thank you

Actions #4

Updated by Michael Kay 17 days ago

If you're still having problems getting the Saxon diagnostics, remember that you can try it on the command line:

java net.sf.saxon.Transform -xsl:kebirschematron.xslt -nogo

which in this case reports:

Error near {...:isSorted($accoundMainIdLis...} at char 5 in xsl:if/@test on line 892 column 69 of kebirschematron.xslt:
  XPST0017  Cannot find a 1-argument function named Q{localFunctions}isSorted()
Errors were reported during stylesheet compilation
Actions #5

Updated by Michael Kay 9 days ago

  • Status changed from New to Closed

Please register to edit this issue

Also available in: Atom PDF