IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: TijnOnlijn
About
User Name: TijnOnlijn
Forum Rank: Newbie
Real Name:
Location Netherlands
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Thursday, October 11, 2018
Last Visit: Thursday, October 11, 2018 12:36:32 PM
Number of Posts: 5
[0.03% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Show Nodes and Values of input XML in XSL-FO
Posted: Thursday, October 11, 2018 12:11:06 PM
Works perfect, thank you!
Topic: Show Nodes and Values of input XML in XSL-FO
Posted: Thursday, October 11, 2018 8:37:43 AM
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),'&#x200B;')">
                                <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?

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.