0

I will clean up in, with a xml stylesheet, my issues are the I can not get the NODE, and output its again nothing happen. :-D

<?xml version="1.0" encoding="UTF-8"?>
<!--XML file created by Microsoft Dynamics C5-->
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2">
    <cbc:UBLVersionID schemeAgencyID="320" schemeAgencyName="urn:oioubl:id:profileid-1.1">2.0</cbc:UBLVersionID>
    <cbc:CustomizationID>OIOUBL-2.02</cbc:CustomizationID>
    <cbc:ProfileID schemeID="urn:oioubl:id:profileid-1.2" schemeAgencyID="320">Procurement-BilSim-1.0</cbc:ProfileID>
    <cbc:ID>237997</cbc:ID>
    <cbc:IssueDate>2021-04-16</cbc:IssueDate>
    <cbc:InvoiceTypeCode listID="urn:oioubl:codelist:invoicetypecode-1.1" listAgencyID="320">380</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>DKK</cbc:DocumentCurrencyCode>
    <cbc:AccountingCostCode>
</cbc:AccountingCostCode>
</Invoice>

I Just need a xslt stylesheet I can start with, so I can see how the stylesheet should look like, so I need help to make a xml there look like this, clean and simple. Hope someone can help me.

Jens Andersen

<?xml version="1.0" encoding="UTF-8"?>
<!--XML file created by Microsoft Dynamics C5-->
<Invoice>
    <ID>237997</ID>
    <IssueDate>2021-04-16</IssueDate>
    <InvoiceTypeCode>380</InvoiceTypeCode>
    <DocumentCurrencyCode>DKK</DocumentCurrencyCode>
</Invoice>

the stylelook like this

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ms="http://www.test.com/schemas/test" 
xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsi ms ns xsl">
    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
    <xsl:template match="/">
    <xsl:apply-templates select="@*"/><!-- copy some elements in a specific order  -->
        <xsl:apply-templates/>
            <order>
                <variables>
                        <variable name="ID">
                        <xsl:value-of select="Invoice/ID"/>
                        </variable>
                    <variable name="IssueDate">
                        <xsl:value-of select="Invoice/IssueDate"/>
                    </variable>
                    <variable name="InvoiceTypeCode">
                        <xsl:value-of select="Invoice/InvoiceTypeCode"/>
                    </variable>
                </variables>
            </order>
    </xsl:template>

</xsl:stylesheet>

EDIT: Thanks for all the tips and links, i haven found the solution and its are

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" 
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" 
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" 
xmlns:ccts="urn:un:unece:uncefact:documentation:2" 
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" 
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:wix="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"

>




<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<xsl:template match="/">
<Order>
    <FrontendID>KOMITEEN FOR SUNDHED</FrontendID>
    <CustomerID>14035338</CustomerID>
    <Action>PlaceOrder</Action>
    <Shipment>
     <ContactName><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:Contact/cbc:ID"/></ContactName>
     <Company><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:PartyName/cbc:Name"/></Company>
     <Address><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:PostalAddress/cbc:StreetName"/></Address>
     <PostCode><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:PostalAddress/cbc:PostalZone"/></PostCode>
     <City><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:PostalAddress/cbc:CityName"/></City>
     <CountryCode><xsl:value-of select="wix:Invoice/cac:BuyerCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode"/></CountryCode>
    </Shipment>
      <Payment>
      <ReferenceNo><xsl:value-of select="wix:Invoice/cac:OrderReference/cbc:SalesOrderID"/></ReferenceNo>
    </Payment>
    <OrderLines>
    
   
        <xsl:for-each select="wix:Invoice/cac:InvoiceLine">

    
     <xsl:if test="cac:Item/cac:SellersItemIdentification/cbc:ID!='1002' and cac:Item/cac:SellersItemIdentification/cbc:ID!='1005-2'">

   
      <OrderLine>
        <ItemNo>KFS-<xsl:value-of select="cac:Item/cac:SellersItemIdentification/cbc:ID"/></ItemNo>
        <Productname><xsl:value-of select="cac:Item/cbc:Description"/></Productname>
        <Quantity><xsl:value-of select="cbc:InvoicedQuantity"/></Quantity>
      </OrderLine>
    </xsl:if>

      </xsl:for-each>
    </OrderLines>
    
    

</Order>
</xsl:template>
</xsl:stylesheet>

0 Answers0