Saxonne J'utilise XSLT 3.0 pour transformer ce document JSON à ce document XML avec la fonction JSON-à-xml,JSON XML avec XSLT 3.0 en utilisant
<xsl:variable name="input-as-xml" select="json-to-xml(.)"/>
De ce que je passe Saxonne JSON comme le document XML:
String XML = "<root>" + JSON + "</root>";
je reçois un XML quand appeler la fonction JSON-à-xml:
<?xml version="1.0" encoding="utf-8"?>
<map
xmlns="http://www.w3.org/2005/xpath-functions">
<string key="_D">urn:oasis:names:specification:ubl:schema:xsd:Invoice-2</string>
<string key="_S">urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2</string>
<string key="_B">urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2</string>
<array key="Invoice">
<map>
<array key="ID">
<map>
<string key="IdentifierContent">123</string>
</map>
</array>
<array key="IssueDate">
<map>
<string key="DateContent">2011-09-22</string>
</map>
</array>
<array key="InvoicePeriod">
<map>
<array key="StartDate">
<map>
<string key="DateContent">2011-08-01</string>
</map>
</array>
<array key="EndDate">
<map>
<string key="DateContent">2011-08-31</string>
</map>
</array>
</map>
</array>
<array key="AccountingSupplierParty">
<map>
<array key="Party">
<map>
<array key="PartyName">
<map>
<array key="Name">
<map>
<string key="TextContent">Custom Cotter Pins</string>
</map>
</array>
</map>
</array>
</map>
</array>
</map>
</array>
<array key="AccountingCustomerParty">
<map>
<array key="Party">
<map>
<array key="PartyName">
<map>
<array key="Name">
<map>
<string key="TextContent">North American Veeblefetzer</string>
</map>
</array>
</map>
</array>
</map>
</array>
</map>
</array>
<array key="LegalMonetaryTotal">
<map>
<array key="PayableAmount">
<map>
<number key="AmountContent">100.00</number>
<string key="AmountCurrencyIdentifier">CAD</string>
</map>
</array>
</map>
</array>
<array key="InvoiceLine">
<map>
<array key="ID">
<map>
<string key="IdentifierContent">1</string>
</map>
</array>
<array key="LineExtensionAmount">
<map>
<number key="AmountContent">100.00</number>
<string key="AmountCurrencyIdentifier">CAD</string>
</map>
</array>
<array key="Item">
<map>
<array key="Description">
<map>
<string key="TextContent">Cotter pin, MIL-SPEC</string>
</map>
</array>
</map>
</array>
</map>
</array>
</map>
</array>
</map>
Est-il correct de passer ce XML en paramètre?
<xsl:apply-templates select="$input-as-xml" />
S'il vous plaît, toute suggestion dans la façon dont je peux utiliser des modèles pour transformer le XML que je veux? Je veux juste quelques suggestions.
C'est l'exemple que je cherchais, il est clair et bien utile ont encore à mettre les attributs dans le fichier XML: 100,00 cbc: LineExtensionAmount>. Merci Martin Honnen. –
@Frankhuaylinosvelasquez, vous devriez être en mesure d'étendre la feuille de style en ajoutant un modèle de vérification pour le contenu particulier de par exemple. ' 100.00 CAD ' et ensuite l'afficher avec l'attribut. –
Je vais l'essayer @MartinHonnen, merci encore. –