Closed mangeg closed 3 years ago
Hi, Can you please check if a preceeding element fired-rule
contains the respective test ID? Than I might take it from there...
No, the fired-rule elements only have template and context + the generated mode and priority attributes.
Should it have been generated on the svrl:fired-rule as well?
The full section from XSLT
<!--RULE -->
<xsl:template match="ubl-invoice:Invoice/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)]" mode="M12" priority="1010">
<svrl:fired-rule context="ubl-invoice:Invoice/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)]" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="false()" />
<xsl:otherwise>
<svrl:failed-assert test="false()">
<xsl:attribute name="id">PEPPOL-EN16931-R041</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>Allowance/charge base amount MUST
be provided when allowance/charge percentage is provided.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M12" select="*" />
</xsl:template>
from Schematron
<!-- Allowance/Charge (document level/line level) -->
<rule context="ubl-invoice:Invoice/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)]">
<assert id="PEPPOL-EN16931-R041" test="false()" flag="fatal">Allowance/charge base amount MUST
be provided when allowance/charge percentage is provided.</assert>
</rule>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Finally - that was done in ph-schematron 6.0.1
Would it be possible to add the assert id from schematron/XSLT files in the
AbstractSVRLMessage
(SVRLFailedAssert
,SVRLSuccessfulReport
)?The ID I have in mind is "PEPPOL-EN16931-R041" from the sample below. When using ph-bdve-peppol to validate files, the returned
ValidationResults
and the containing errorsgetErrorID()
returns null. I am not sure if the intent of the errorId is to contains this type of information. But I did a test in a fork where I added fetching of error ID fromFailedAssert
inSVRLFailedAssert
andSVRLSuccessfulReport
viaAbstractSVRLMessage
, https://github.com/mangeg/ph-schematron/commit/f5d4fb6fe827d5a808c9f9cf996668c3515c289f. With these changes I am able to get the assert id fromIError.getErrorID()
.The use for this would be to be able to programmatically act on results without depending on the readable validation message, ie. (Allowance/charge base amount MUST be provided when Allowance/charge percentage is provided.) in the sample.
From PEPPOL-EN16931-UBL.sch
SCH:
XSLT: