|
Rank: Newbie
Joined: 10/11/2018 Posts: 5 Location: Netherlands
|
Hi,
I have a third party application that produces a XML file to undergo a XSLT-FO transformation into a PDF file.
Consider the following XML input file
Code: <?xml version="1.0" encoding="UTF-8"?> <Order xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <OrganizationEDICode>GS_Buyer_ind</OrganizationEDICode> <Note>1311</Note> <Description>Within 7 days Due net</Description> <Creator>Demo User</Creator> <DeliveryAddress> <Postbox>Postbox_name</Postbox> <StreetName>StreetName</StreetName> <AdditionalStreetName>Additional_info</AdditionalStreetName> </DeliveryAddress> <OrderLine> <LineNumber>1</LineNumber> <Data> <Category>008</Category> <CategoryName>Desktop PCs</CategoryName> <ContractNumber>1242CC</ContractNumber> </Data> <Pricing> <ConversionDenumerator>1.000000</ConversionDenumerator> <ConversionNumerator>1.000000</ConversionNumerator> </Pricing> </OrderLine> </Order>
THe problem is that i don't know the exact input as it changes in node names and values. For debugging purposes I would like to create a PDF file showing the exact XML as inputted.
I only came this far, which produces the content and not the node names:
Code: <xsl:param name="SV_OutputFormat" select="'PDF'"/> <xsl:variable name="XML" select="/"/>
Code: <fo:block font-family="Calibri" line-height="1"> <xsl:for-each select="$XML"> <xsl:for-each select="Order"> <xsl:for-each select="OrderLine"> <xsl:variable name="value-of-template_1"> <xsl:apply-templates/> </xsl:variable> <xsl:choose> <xsl:when test="contains(string($value-of-template_24),'​')"> <fo:block> <xsl:copy-of select="$value-of-template_24"/> </fo:block> </xsl:when> <xsl:otherwise> <fo:inline> <xsl:copy-of select="$value-of-template_1"/> </fo:inline> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:for-each> </xsl:for-each> </fo:block> <fo:block id="SV_RefID_PageTotal"/>
Ideally I would like to have a PDF showing the XML like the exact input (but as a PDF) or writting down with node names and values like:
Code: /Order/OrganizationEDICode = GS_Buyer_ind /Order/Note = 1331 /Order/Description = Within 7 days Due net /Order/Creator = Demo User /Order/DeliveryAddress/Postbox = Postbox_name /Order/OrderLine/Data/CategoryName = Desktop PCs etc..
Can you guide me in the right direction?
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
Very easy in StyleVision:
1. Select XSLT 3.0 2. Design as in picture 3. Use the following XPath statement for AutoCalc:
serialize( ., map{ "indent" : true() } ) vlad attached the following image(s):
|
|
Rank: Newbie
Joined: 10/11/2018 Posts: 5 Location: Netherlands
|
Works perfect, thank you!
|
|
guest |