Search Posts

Visits: 590

前回紹介したJP PINTに同梱されているスタイルシート(XSLT)では、エラーメッセージのみの出力で問題箇所の特定が困難でした。

1.JP PINT 1.0に同梱されているスタイルシートは

少し前に紹介した記事、JP PINT 0.9.1のCEF eInvoicing – EN16931に倣ったスキーマトロン検証環境テスト に従ってスタイルシート(XSLT)ファイルの作成と検証テストを実施しました。
CEF eInvoicing – EN16931(https://github.com/ConnectingEurope/eInvoicing-EN16931 )は、JP PINT開発に貢献されたOriol Bausa氏やPhilip Helger氏を中心としたGitHubです。
テスト作業後再度確認したところ、本手順で作成したスタイルシート(XSLT)ファイルは、次のCopyright表記が無いだけで、同一のものでした。
スタイルシート(XSLT)ファイルの問題でなくテスト方法の問題でした。
CEF e-Invoiceの環境でないと、詳細エラー箇所を表示しないので留意してください(2022-11-02追記)。

<!--

            Copyright (C) 2020-2023 OpenPEPPOL AISBL

            Licensed under the Apache License, Version 2.0 (the "License");
            you may not use this file except in compliance with the License.
            You may obtain a copy of the License at

                    http://www.apache.org/licenses/LICENSE-2.0

            Unless required by applicable law or agreed to in writing, software
            distributed under the License is distributed on an "AS IS" BASIS,
            WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
            See the License for the specific language governing permissions and
            limitations under the License.

-->

提供されたスタイルシート(XSLT)ファイルを使用した検証作業について4. スタイルシート(XSLT)検証以降に記載していますので、お急ぎの方は、ルール定義(スキーマトロン)ファイルからスタイルシート生成の箇所を飛ばして、4.からお読みください。

2. mvn実行のための準備作業

mvn環境構築については、上記の記事をご確認下さい。
a) スキーマトロンファイルからスタイルシート(XSLT)ファイルに変換するパラメタ指定ファイル および
b) スタイルシート(XSLT)ファイルで検証するためのパラメタ指定ファイル
の2種類のxmlファイルを準備します。

3. スタイルシート(XSLT)ファイル作成

3.1. スタイルシート(XSLT)ファイルへの変換パラメタ

jp-pintーxslt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed under European Union Public Licence (EUPL) version 1.2.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.helger</groupId>
    <artifactId>parent-pom</artifactId>
    <version>1.10.8</version>
  </parent>
  <artifactId>centc434-validation-rules</artifactId>
  <version>1.0.0</version>
  <name>centc434-validation-rules</name>
  <description>EN16931 - CEN/TC 434 validation rules</description>
  <url>https://github.com/CenPC434/validation</url>
  <inceptionYear>2016</inceptionYear>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <build>
    <plugins>
      <plugin>
        <groupId>com.helger.maven</groupId>
        <artifactId>ph-schematron-maven-plugin</artifactId>
        <version>5.2.0</version>
        <executions>
          <execution>
            <id>ubl</id>
            <goals>
              <goal>convert</goal>
            </goals>
            <configuration>
              <schematronDirectory>${basedir}/pint-jp-resources-dev/trn-invoice/schematron/</schematronDirectory>
              <xsltDirectory>${basedir}/xslt</xsltDirectory>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <schematronPattern>*.sch</schematronPattern>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

3.2. 変換スクリプト

jp-pint-xslt.sh

# !/bin/sh
# === Initialize shell environment ===================================
set -eux
export LC_ALL=C
Tmp=/tmp/${0##*/}.$$
# === Log ============================================================
exec 2>$Tmp.log

result=0

echo 'convert to XSLT - takes forever'
mvn -f jp-pint-xslt.xml process-resources 2>&1 || result=$?
if [ ! "$result" = "0" ]; then
  echo >&2 'ERROR convert'
  exit 1
fi

rm $Tmp*
exit 0

3.3 スタイルシート(XSLT)ファイルへの変換

次のコマンドを実行してスタイルシート(XSLT)ファイルを生成します。
$ ./jp-pint-xslt.sh > jp-pint-xslt.log

実行結果ファイル jp-pint-xslt.log
注:ログ中のファイル名は、その先頭を….と省略して表記しています。

convert to XSLT - takes forever
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< com.helger:centc434-validation-rules >----------------
[INFO] Building centc434-validation-rules 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- ph-buildinfo-maven-plugin:3.0.0:generate-buildinfo (default) @ centc434-validation-rules ---
[INFO] Successfully created temp directory buildinfo-maven-plugin
[INFO] 
[INFO] --- ph-schematron-maven-plugin:5.2.0:convert (ubl) @ centc434-validation-rules ---
[INFO] Converting Schematron file '..../JP PINT 1.0/pint-jp-resources-dev/trn-invoice/schematron/PINT-jurisdiction-aligned-rules.sch' to XSLT file '..../JP PINT 1.0/xslt/PINT-jurisdiction-aligned-rules.xslt'
[WARNING] ..../JP PINT 1.0/pint-jp-resources-dev/trn-invoice/schematron/PINT-jurisdiction-aligned-rules.sch [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[INFO] Converting Schematron file '..../JP PINT 1.0/pint-jp-resources-dev/trn-invoice/schematron/PINT-UBL-validation-preprocessed.sch' to XSLT file '..../JP PINT 1.0/xslt/PINT-UBL-validation-preprocessed.xslt'
[WARNING] ..../JP PINT 1.0/pint-jp-resources-dev/trn-invoice/schematron/PINT-UBL-validation-preprocessed.sch [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[WARNING] ..../JP PINT 1.0/pint-jp-resources-dev/trn-invoice/schematron/PINT-UBL-validation-preprocessed.sch [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ centc434-validation-rules ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory ..../JP PINT 1.0/src/main/resources
[INFO] Copying 1 resource to META-INF
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.789 s
[INFO] Finished at: 2022-11-01T19:17:10+09:00
[INFO] ------------------------------------------------------------------------

4. スタイルシート(XSLT)検証

4.1. スタイルシート(XSLT)検証パラメタ

Sharedルール検証パラメタ

jp-pint-shared-validate.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed under European Union Public Licence (EUPL) version 1.2.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.helger</groupId>
    <artifactId>parent-pom</artifactId>
    <version>1.10.8</version>
  </parent>
  <artifactId>JP-PINT-SHARED-RULES</artifactId>
  <version>1.0.0</version>
  <name>jp-pint-shared-rules</name>
  <description>JP PINT validation rules</description>
  <url>https://github.com/CenPC434/validation</url>
  <inceptionYear>2016</inceptionYear>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <build>
    <plugins>
      <plugin>
        <groupId>com.helger.maven</groupId>
        <artifactId>ph-schematron-maven-plugin</artifactId>
        <version>5.2.0</version>
        <executions>
          <execution>
            <id>PINT Shared</id>
            <phase>validate</phase>
            <goals>
              <goal>validate</goal>
            </goals>
            <configuration>
              <xmlDirectory>pint-jp-resources-dev/trn-invoice/example</xmlDirectory>
              <schematronProcessingEngine>XSLT</schematronProcessingEngine>
              <schematronFile>xslt/PINT-UBL-validation-preprocessed.xslt</schematronFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Alignedルール検証パラメタ

jp-pint-aligned-validate.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed under European Union Public Licence (EUPL) version 1.2.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.helger</groupId>
    <artifactId>parent-pom</artifactId>
    <version>1.10.8</version>
  </parent>
  <artifactId>JP-PINT-ALIGNED-RULES</artifactId>
  <version>1.0.0</version>
  <name>jp-pint-alignned-rules</name>
  <description>PINT validation rules</description>
  <url>https://github.com/CenPC434/validation</url>
  <inceptionYear>2016</inceptionYear>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <build>
    <plugins>
      <plugin>
        <groupId>com.helger.maven</groupId>
        <artifactId>ph-schematron-maven-plugin</artifactId>
        <version>5.2.0</version>
        <executions>
          <execution>
            <id>Japan Aligned</id>
            <phase>validate</phase>
            <goals>
              <goal>validate</goal>
            </goals>
            <configuration>
              <xmlDirectory>pint-jp-resources-dev/trn-invoice/example</xmlDirectory>
              <schematronProcessingEngine>XSLT</schematronProcessingEngine>
              <schematronFile>xslt/PINT-jurisdiction-aligned-rules.xslt</schematronFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

4.2. 検証スクリプト

jp-pint-validate.sh

# !/bin/bash
# === Initialize shell environment ===================================
set -eux
export LC_ALL=C
Tmp=/tmp/${0##*/}.$$
# === Log ============================================================
exec 2>$Tmp.log

result=0

echo 'validate JP PINT SHARED'
mvn -f jp-pint-shared-validate.xml validate 2>&1 || result1=$?

echo 'validate JP PINT ALIGNED'
mvn -f jp-pint-aligned-validate.xml validate 2>&1 || result2=$?

rm $Tmp*
exit 0

4.3. スタイルシート(XSLT)ファイルでルール検証

次のコマンドを実行してルール検証します。
$ ./jp-pint-validate.sh > jp-pint-validate.log

実行結果ファイル jp-pint-validate.log
注:ログ中のファイル名は、その先頭を….と省略して表記しています。

validate JP PINT SHARED
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.helger:JP-PINT-SHARED-RULES >-------------------
[INFO] Building jp-pint-shared-rules 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- ph-schematron-maven-plugin:5.2.0:validate (PINT Shared) @ JP-PINT-SHARED-RULES ---
[INFO] Compiling XSLT instance [file=..../xslt/PINT-UBL-validation-preprocessed.xslt]
[WARNING] ..../xslt/PINT-UBL-validation-preprocessed.xslt [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[WARNING] ..../xslt/PINT-UBL-validation-preprocessed.xslt [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[INFO] Successfully parsed Schematron file '..../xslt/PINT-UBL-validation-preprocessed.xslt'
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example9-SumInv1 and O.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Creating JAXB context for package org.oclc.purl.dsdl.svrl using ClassLoader ClassRealm[plugin>com.helger.maven:ph-schematron-maven-plugin:5.2.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@42110406]
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example5-AllowanceCharge.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example4-SumInv2.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example7-Return.Quan.ItPr.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example6-CorrInv.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example1-minimum.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml' against Schematron rules from '..../xslt/PINT-UBL-validation-preprocessed.xslt' expecting success
[ERROR] 3 failed Schematron assertions for XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml'
[ERROR] [fatal_error] in /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:AccountingSupplierParty[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1]/*:Party[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1] @ ..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml [ibr-081]-The Seller electronic address (ibt-049) MUST be provided. Test=cbc:EndpointID
[ERROR] [fatal_error] in /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:LegalMonetaryTotal[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1] @ ..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml [ibr-co-11]-Sum of allowances on document level (ibt-107) = ? Document level allowance amount (ibt-092). Test=xs:decimal(cbc:AllowanceTotalAmount) = (round(sum(../cac:AllowanceCharge[cbc:ChargeIndicator=false()]/xs:decimal(cbc:Amount)) * 10 * 10) div 100) or (not(cbc:AllowanceTotalAmount) and not(../cac:AllowanceCharge[cbc:ChargeIndicator=false()]))
[ERROR] [fatal_error] in /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:LegalMonetaryTotal[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1] @ ..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml [ibr-co-13]-Invoice total amount without Tax (ibt-109) = ? Invoice line net amount (ibt-131) - Sum of allowances on document level (ibt-107) + Sum of charges on document level (ibt-108). Test=((cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (xs:decimal(cbc:TaxExclusiveAmount) = round((xs:decimal(cbc:LineExtensionAmount) + xs:decimal(cbc:ChargeTotalAmount) - xs:decimal(cbc:AllowanceTotalAmount)) * 10 * 10) div 100 )) or (not(cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (xs:decimal(cbc:TaxExclusiveAmount) = round((xs:decimal(cbc:LineExtensionAmount) - xs:decimal(cbc:AllowanceTotalAmount)) * 10 * 10 ) div 100)) or ((cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (xs:decimal(cbc:TaxExclusiveAmount) = round((xs:decimal(cbc:LineExtensionAmount) + xs:decimal(cbc:ChargeTotalAmount)) * 10 * 10 ) div 100)) or (not(cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (xs:decimal(cbc:TaxExclusiveAmount) = xs:decimal(cbc:LineExtensionAmount)))
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.293 s
[INFO] Finished at: 2022-11-01T19:31:37+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.helger.maven:ph-schematron-maven-plugin:5.2.0:validate (PINT Shared) on project JP-PINT-SHARED-RULES: 3 failed Schematron assertions for XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
validate JP PINT ALIGNED
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.helger:JP-PINT-ALIGNED-RULES >------------------
[INFO] Building jp-pint-alignned-rules 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- ph-schematron-maven-plugin:5.2.0:validate (Japan Aligned) @ JP-PINT-ALIGNED-RULES ---
[INFO] Compiling XSLT instance [file=..../xslt/PINT-jurisdiction-aligned-rules.xslt]
[WARNING] ..../xslt/PINT-jurisdiction-aligned-rules.xslt [0:0]: Transformation warning - A function that computes atomic values should use xsl:sequence rather than xsl:value-of
[INFO] Successfully parsed Schematron file '..../xslt/PINT-jurisdiction-aligned-rules.xslt'
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example9-SumInv1 and O.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Creating JAXB context for package org.oclc.purl.dsdl.svrl using ClassLoader ClassRealm[plugin>com.helger.maven:ph-schematron-maven-plugin:5.2.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@42110406]
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example5-AllowanceCharge.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example4-SumInv2.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example7-Return.Quan.ItPr.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example6-CorrInv.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Example1-minimum.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[INFO] Validating XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml' against Schematron rules from '..../xslt/PINT-jurisdiction-aligned-rules.xslt' expecting success
[ERROR] 1 failed Schematron assertions for XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml'
[ERROR] [fatal_error] in /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1] @ ..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml [aligned-ibrp-001-jp]-Specification identifier MUST start with the value 'urn:fdc:peppol:jp:billing:3.0'. Test=starts-with(normalize-space(cbc:CustomizationID/text()), 'urn:fdc:peppol:jp:billing:3.0')
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.462 s
[INFO] Finished at: 2022-11-01T19:31:42+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.helger.maven:ph-schematron-maven-plugin:5.2.0:validate (Japan Aligned) on project JP-PINT-ALIGNED-RULES: 1 failed Schematron assertions for XML file '..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

この実行結果には、問題箇所が
[ERROR] [fatal_error] in /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:AccountingSupplierParty[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1]/*:Party[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1] @ ..../pint-jp-resources-dev/trn-invoice/example/Japan PINT Invoice UBL Error.xml [ibr-081]-The Seller electronic address (ibt-049) MUST be provided. Test=cbc:EndpointID
と記録されています。人が見るとよくわからないかもしれませんが、このデータには、エラーメッセージ
[ibr-081]-The Seller electronic address (ibt-049) MUST be provided. Test=cbc:EndpointID
だけでなく、XPathで問題箇所が記録されているので、問題箇所を簡単に見つけることができます。
/*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:AccountingSupplierParty[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1]/*:Party[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1]
この文字列中の名前空間を記号で表すと次のように見慣れた形になります。
/ubl:Invoice[1]/cac:AccountingSupplierParty[1]/cac:Party[1]
こうしたデータを利用すると問題箇所を強調表示するなど利用者に分かりやすい形で結果を表示するプログラムを提供することができます。

貴重なエンジニアを有効活用するには、これらのデータ処理の仕事から「作業」を無くすことが重要です。

5. ディレクトリ構成

テスト環境のディレクトリ(…./JP PINT 1.0/)構成を次に示します。

.
├── jp-pint-aligned-validate.xml
├── jp-pint-shared-validate.xml
├── jp-pint-validate.log
├── jp-pint-validate.sh
├── jp-pint-validate.xml
├── jp-pint-xslt.log
├── jp-pint-xslt.sh
├── jp-pint-xslt.xml
├── pint-jp-resources-dev
│   ├── PINT-UBL-validation-shared.html
│   ├── common
│   │   ├── PINT-UBL-validation-aligned-japan.xslt
│   │   ├── PINT-UBL-validation-shared.xslt
│   │   └── docs
│   ├── homepage
│   └── trn-invoice
│       ├── codelist
│       ├── example
│       │   ├── Japan PINT Invoice UBL Error.xml
│       │   ├── Japan PINT Invoice UBL Example.xml
│       │   ├── Japan PINT Invoice UBL Example1-minimum.xml
│       │   ├── Japan PINT Invoice UBL Example2-TaxAcctCur.xml
│       │   ├── Japan PINT Invoice UBL Example3-SumInv1.xml
│       │   ├── Japan PINT Invoice UBL Example4-SumInv2.xml
│       │   ├── Japan PINT Invoice UBL Example5-AllowanceCharge.xml
│       │   ├── Japan PINT Invoice UBL Example6-CorrInv.xml
│       │   ├── Japan PINT Invoice UBL Example7-Return.Quan.ItPr.xml
│       │   └── Japan PINT Invoice UBL Example9-SumInv1 and O.xml
│       ├── schematron
│       │   ├── PINT-UBL-validation-preprocessed.sch
│       │   └── PINT-jurisdiction-aligned-rules.sch
│       ├── semantic-model.yaml
│       └── syntax-binding.yaml
└── xslt
    ├── PINT-UBL-validation-preprocessed.xslt
    └── PINT-jurisdiction-aligned-rules.xslt