Skip to content

Gallery

Real-world XML documents rendered with unxml, syntax-highlighted with the same grammar unxml ships for bat.

The basics below are shown inline — original source on the left, unxml output on the right. The gallery further down links full-page renders of larger real-world documents, with original-vs-rendered size comparisons.

Invoice basics

CII / Factur-X — minimal invoice

factur-x-basic.xml · 130 → 97 lines

XML source
<?xml version="1.0" encoding="UTF-8" ?>
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100">
    <!-- generated by: mustangproject.org vnull-->
    <rsm:ExchangedDocumentContext>
        <ram:GuidelineSpecifiedDocumentContextParameter>
            <ram:ID>urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic</ram:ID>
        </ram:GuidelineSpecifiedDocumentContextParameter>
    </rsm:ExchangedDocumentContext>
    <rsm:ExchangedDocument>
        <ram:ID>471102</ram:ID>
        <ram:TypeCode>380</ram:TypeCode>
        <ram:IssueDateTime>
            <udt:DateTimeString format="102">20241115</udt:DateTimeString>
        </ram:IssueDateTime>
        <ram:IncludedNote>
            <ram:Content>Rechnung gemäß Bestellung vom 01.11.2024.</ram:Content>
        </ram:IncludedNote>
        <ram:IncludedNote>
            <ram:Content>Lieferant GmbH
                Lieferantenstraße 20
                80333 München
                Deutschland
                Geschäftsführer: Hans Muster
                Handelsregisternummer: H A 123</ram:Content>
        </ram:IncludedNote>
        <ram:IncludedNote>
            <ram:Content>Unsere GLN: 4000001123452
                Ihre GLN: 4000001987658
                Ihre Kundennummer: GE2020211
                Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.</ram:Content>
        </ram:IncludedNote>
    </rsm:ExchangedDocument>
    <rsm:SupplyChainTradeTransaction>
        <ram:IncludedSupplyChainTradeLineItem>
            <ram:AssociatedDocumentLineDocument>
                <ram:LineID>1</ram:LineID>
            </ram:AssociatedDocumentLineDocument>
            <ram:SpecifiedTradeProduct>
                <ram:GlobalID schemeID="0160">4012345001235</ram:GlobalID>
                <ram:Name>GTIN: 4012345001235
                    Unsere Art.-Nr.: TB100A4
                    Trennblätter A4
                </ram:Name>
            </ram:SpecifiedTradeProduct>
            <ram:SpecifiedLineTradeAgreement>
                <ram:NetPriceProductTradePrice>
                    <ram:ChargeAmount>9.9000</ram:ChargeAmount>
                    <ram:BasisQuantity unitCode="H87">1.0000</ram:BasisQuantity>
                </ram:NetPriceProductTradePrice>
            </ram:SpecifiedLineTradeAgreement>
            <ram:SpecifiedLineTradeDelivery>
                <ram:BilledQuantity unitCode="H87">20.0000</ram:BilledQuantity>
            </ram:SpecifiedLineTradeDelivery>
            <ram:SpecifiedLineTradeSettlement>
                <ram:ApplicableTradeTax>
                    <ram:TypeCode>VAT</ram:TypeCode>
                    <ram:CategoryCode>S</ram:CategoryCode>
                    <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
                </ram:ApplicableTradeTax>
                <ram:SpecifiedTradeSettlementLineMonetarySummation>
                    <ram:LineTotalAmount>198.00</ram:LineTotalAmount>
                </ram:SpecifiedTradeSettlementLineMonetarySummation>
            </ram:SpecifiedLineTradeSettlement>
        </ram:IncludedSupplyChainTradeLineItem>
        <ram:ApplicableHeaderTradeAgreement>
            <ram:SellerTradeParty>
                <ram:Name>Lieferant GmbH</ram:Name>
                <ram:PostalTradeAddress>
                    <ram:PostcodeCode>80333</ram:PostcodeCode>
                    <ram:LineOne>Lieferantenstraße 20</ram:LineOne>
                    <ram:CityName>München</ram:CityName>
                    <ram:CountryID>DE</ram:CountryID>
                </ram:PostalTradeAddress>
                <ram:SpecifiedTaxRegistration>
                    <ram:ID schemeID="VA">DE123456789</ram:ID>
                </ram:SpecifiedTaxRegistration>
                <ram:SpecifiedTaxRegistration>
                    <ram:ID schemeID="FC">201/113/40209</ram:ID>
                </ram:SpecifiedTaxRegistration>
            </ram:SellerTradeParty>
            <ram:BuyerTradeParty>
                <ram:Name>Kunden AG Mitte</ram:Name>
                <ram:PostalTradeAddress>
                    <ram:PostcodeCode>69876</ram:PostcodeCode>
                    <ram:LineOne>Hans Muster</ram:LineOne>
                    <ram:LineTwo>Kundenstraße 15</ram:LineTwo>
                    <ram:CityName>Frankfurt</ram:CityName>
                    <ram:CountryID>DE</ram:CountryID>
                </ram:PostalTradeAddress>
            </ram:BuyerTradeParty>
        </ram:ApplicableHeaderTradeAgreement>
        <ram:ApplicableHeaderTradeDelivery>
            <ram:ActualDeliverySupplyChainEvent>
                <ram:OccurrenceDateTime>
                    <udt:DateTimeString format="102">20241114</udt:DateTimeString>
                </ram:OccurrenceDateTime>
            </ram:ActualDeliverySupplyChainEvent>
        </ram:ApplicableHeaderTradeDelivery>
        <ram:ApplicableHeaderTradeSettlement>
            <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
            <ram:ApplicableTradeTax>
                <ram:CalculatedAmount>37.62</ram:CalculatedAmount>
                <ram:TypeCode>VAT</ram:TypeCode>
                <ram:BasisAmount>198.00</ram:BasisAmount>
                <ram:CategoryCode>S</ram:CategoryCode>
                <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
            </ram:ApplicableTradeTax>
            <ram:SpecifiedTradePaymentTerms>
                <ram:Description>Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.</ram:Description>
                <ram:DueDateDateTime>
                    <udt:DateTimeString format="102">20241215</udt:DateTimeString>
                </ram:DueDateDateTime>
            </ram:SpecifiedTradePaymentTerms>
            <ram:SpecifiedTradeSettlementHeaderMonetarySummation>
                <ram:LineTotalAmount>198.00</ram:LineTotalAmount>
                <ram:ChargeTotalAmount>0.00</ram:ChargeTotalAmount>
                <ram:AllowanceTotalAmount>0.00</ram:AllowanceTotalAmount>
                <ram:TaxBasisTotalAmount>198.00</ram:TaxBasisTotalAmount>
                <ram:TaxTotalAmount currencyID="EUR">37.62</ram:TaxTotalAmount>
                <ram:GrandTotalAmount>235.62</ram:GrandTotalAmount>
                <ram:TotalPrepaidAmount>0.00</ram:TotalPrepaidAmount>
                <ram:DuePayableAmount>235.62</ram:DuePayableAmount>
            </ram:SpecifiedTradeSettlementHeaderMonetarySummation>
        </ram:ApplicableHeaderTradeSettlement>
    </rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>
unxml --auto
CrossIndustryInvoice(
    xmlns="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100",
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance")
  ExchangedDocumentContext
    GuidelineSpecifiedDocumentContextParameter
      ID = urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic
  ExchangedDocument
    ID = 471102
    TypeCode = 380
    IssueDateTime
      DateTimeString(format="102") = 20241115
    IncludedNote
      Content = Rechnung gemäß Bestellung vom 01.11.2024.
    IncludedNote
      Content =
        | Lieferant GmbH
        |                 Lieferantenstraße 20
        |                 80333 München
        |                 Deutschland
        |                 Geschäftsführer: Hans Muster
        |                 Handelsregisternummer: H A 123
    IncludedNote
      Content =
        | Unsere GLN: 4000001123452
        |                 Ihre GLN: 4000001987658
        |                 Ihre Kundennummer: GE2020211
        |
        |
        |                 Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.
  SupplyChainTradeTransaction
    IncludedSupplyChainTradeLineItem
      AssociatedDocumentLineDocument
        LineID = 1
      SpecifiedTradeProduct
        GlobalID(schemeID="0160") = 4012345001235
        Name =
          | GTIN: 4012345001235
          |                     Unsere Art.-Nr.: TB100A4
          |                     Trennblätter A4
      SpecifiedLineTradeAgreement
        NetPriceProductTradePrice
          ChargeAmount = 9.9000
          BasisQuantity(unitCode="H87") = 1.0000
      SpecifiedLineTradeDelivery
        BilledQuantity(unitCode="H87") = 20.0000
      SpecifiedLineTradeSettlement
        ApplicableTradeTax
          TypeCode = VAT
          CategoryCode = S
          RateApplicablePercent = 19.00
        SpecifiedTradeSettlementLineMonetarySummation
          LineTotalAmount = 198.00
    ApplicableHeaderTradeAgreement
      SellerTradeParty
        Name = Lieferant GmbH
        PostalTradeAddress
          PostcodeCode = 80333
          LineOne = Lieferantenstraße 20
          CityName = München
          CountryID = DE
        SpecifiedTaxRegistration
          ID(schemeID="VA") = DE123456789
        SpecifiedTaxRegistration
          ID(schemeID="FC") = 201/113/40209
      BuyerTradeParty
        Name = Kunden AG Mitte
        PostalTradeAddress
          PostcodeCode = 69876
          LineOne = Hans Muster
          LineTwo = Kundenstraße 15
          CityName = Frankfurt
          CountryID = DE
    ApplicableHeaderTradeDelivery
      ActualDeliverySupplyChainEvent
        OccurrenceDateTime
          DateTimeString(format="102") = 20241114
    ApplicableHeaderTradeSettlement
      InvoiceCurrencyCode = EUR
      ApplicableTradeTax
        CalculatedAmount = 37.62
        TypeCode = VAT
        BasisAmount = 198.00
        CategoryCode = S
        RateApplicablePercent = 19.00
      SpecifiedTradePaymentTerms
        Description = Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.
        DueDateDateTime
          DateTimeString(format="102") = 20241215
      SpecifiedTradeSettlementHeaderMonetarySummation
        LineTotalAmount = 198.00
        ChargeTotalAmount = 0.00
        AllowanceTotalAmount = 0.00
        TaxBasisTotalAmount = 198.00
        TaxTotalAmount(currencyID="EUR") = 37.62
        GrandTotalAmount = 235.62
        TotalPrepaidAmount = 0.00
        DuePayableAmount = 235.62

XSLT basics

Build an HTML table with for-each

cdcatalog.xsl · 22 → 15 lines

XSLT source
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
  <h2>My CD Collection</h2>
  <table border="1">
    <tr bgcolor="#9acd32">
      <th style="text-align:left">Title</th>
      <th style="text-align:left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
  </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
unxml --xslt
xsl:stylesheet(version="1.0", xmlns:xsl="http://www.w3.org/1999/XSL/Transform")
  match /:
    html
      body
        h2 = My CD Collection
        table(border="1")
          tr(bgcolor="#9acd32")
            th(style="text-align:left") = Title
            th(style="text-align:left") = Artist
          foreach catalog/cd:
            tr
              td
                <- title
              td
                <- artist

Branch with choose / when / otherwise

cdcatalog-choose.xsl · 32 → 20 lines

XSLT source
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
  <h2>My CD Collection</h2>
  <table border="1">
    <tr bgcolor="#9acd32">
      <th>Title</th>
      <th>Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <xsl:choose>
      <xsl:when test="price &gt; 10">
         <td bgcolor="#ff00ff">
         <xsl:value-of select="artist"/>
         </td>
      </xsl:when>
      <xsl:otherwise>
         <td><xsl:value-of select="artist"/></td>
      </xsl:otherwise>
      </xsl:choose>
    </tr>
    </xsl:for-each>
  </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
unxml --xslt
xsl:stylesheet(version="1.0", xmlns:xsl="http://www.w3.org/1999/XSL/Transform")
  match /:
    html
      body
        h2 = My CD Collection
        table(border="1")
          tr(bgcolor="#9acd32")
            th = Title
            th = Artist
          foreach catalog/cd:
            tr
              td
                <- title
              choose:
                when price > 10:
                  td(bgcolor="#ff00ff")
                    <- artist
                else:
                  td
                    <- artist

Named templates + apply-templates

cdcatalog-templates.xsl · 33 → 20 lines

XSLT source
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
  <h2>My CD Collection</h2>
  <xsl:apply-templates/>
  </body>
  </html>
</xsl:template>
<xsl:template match="cd">
  <p>
    <xsl:apply-templates select="title"/>
    <xsl:apply-templates select="artist"/>
  </p>
</xsl:template>
<xsl:template match="title">
  Title: <span style="color:#ff0000">
  <xsl:value-of select="."/></span>
  <br />
</xsl:template>
<xsl:template match="artist">
  Artist: <span style="color:#00ff00">
  <xsl:value-of select="."/></span>
  <br />
</xsl:template>
</xsl:stylesheet>
unxml --xslt
xsl:stylesheet(version="1.0", xmlns:xsl="http://www.w3.org/1999/XSL/Transform")
  match /:
    html
      body
        h2 = My CD Collection
        apply
  match cd:
    p
      apply title
      apply artist
  match title:
    "Title:"
    span(style="color:#ff0000")
      <- .
    br
  match artist:
    "Artist:"
    span(style="color:#00ff00")
      <- .
    br

Literal-result-element stylesheet

breakfast-menu.xsl · 17 → 15 lines

XSLT source
<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
    <xsl:for-each select="breakfast_menu/food">
      <div style="background-color:teal;color:white;padding:4px">
        <span style="font-weight:bold"><xsl:value-of select="name"/> - </span>
        <xsl:value-of select="price"/>
      </div>
      <div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
        <p>
        <xsl:value-of select="description"/>
        <span style="font-style:italic"> (<xsl:value-of select="calories"/> calories per serving)</span>
        </p>
      </div>
    </xsl:for-each>
  </body>
</html>
unxml --xslt
html(xmlns:xsl="http://www.w3.org/1999/XSL/Transform", xsl:version="1.0")
  body(style="font-family:Arial;font-size:12pt;background-color:#EEEEEE")
    foreach breakfast_menu/food:
      div(style="background-color:teal;color:white;padding:4px")
        span(style="font-weight:bold")
          <- name
          "-"
        <- price
      div(style="margin-left:20px;margin-bottom:1em;font-size:10pt")
        p
          <- description
          span(style="font-style:italic")
            "("
            <- calories
            "calories per serving)"

XML documents

Document Original Rendered Source
UBL — Invoice (instance) 493 lines · 19.2 KB 353 lines · 12.1 KB source
UBL — Order (instance) 341 lines · 13.6 KB 250 lines · 7.5 KB source
UBL — Credit Note (instance) 431 lines · 17.0 KB 308 lines · 10.8 KB source
CII — Invoice (instance) 656 lines · 34.7 KB 431 lines · 14.4 KB source
Factur-X / ZUGFeRD — Extended (instance) 430 lines · 20.6 KB 251 lines · 8.5 KB source

Schemas

Document Original Rendered Source
Finvoice 3.0 1,690 lines · 95.1 KB 1,123 lines · 45.3 KB source
UBL — Core Component Types 731 lines · 44.2 KB 83 lines · 4.0 KB source
UBL — Unqualified Data Types 553 lines · 26.7 KB 38 lines · 1.9 KB source
UBL — Qualified Data Types 69 lines · 3.5 KB 5 lines · 424 B source
UBL — Common Basic Components 5,388 lines · 214.7 KB 1,752 lines · 90.0 KB source
UBL — Common Aggregate Components 39,798 lines · 2.3 MB 5,401 lines · 288.4 KB source
UBL — Common Extension Components 222 lines · 9.3 KB 50 lines · 2.5 KB source
UBL — Invoice 1,001 lines · 58.8 KB 120 lines · 6.1 KB source

XSLT

Document Original Rendered Source
DocBook XSL — HTML driver 558 lines · 20.0 KB 317 lines · 10.0 KB source
DocBook XSL — inline elements 1,598 lines · 49.8 KB 919 lines · 23.5 KB source
DocBook xslTNG 3.0 — function library 863 lines · 30.6 KB 474 lines · 18.8 KB source
DocBook xslTNG 3.0 — variables & maps 428 lines · 20.5 KB 282 lines · 15.1 KB source
DocBook xslTNG 3.0 — localization (try/catch, iterate) 273 lines · 10.2 KB 140 lines · 5.3 KB source
DocBook xslTNG 3.0 — profiling transform 298 lines · 12.2 KB 174 lines · 7.9 KB source
ISO Schematron — SVRL skeleton 614 lines · 21.1 KB 209 lines · 6.3 KB source

Schematron

Document Original Rendered Source
EN16931 — UBL validation (driver) 34 lines · 1.8 KB 19 lines · 948 B source
EN16931 — abstract model rules 341 lines · 51.3 KB 469 lines · 45.9 KB source
EN16931 — UBL bindings 277 lines · 71.1 KB 574 lines · 72.3 KB source