Simplified input XML is as follows (can also be DataB, DataC etc. Each has a different format, but I only want this to be done for DataA. All Data types will be wrapped by Document)
<Document>
<DataA>
<customer>
<name>bank</name>
<address>addr</address>
<website>web</website>
</customer>
<product>product</product>
<currency>EUR</currency>
</Data>
</Document>
I would like to dump all the raw XML data to a PDF. I have looked into different approaches, and most use CDATA as part of the XML input. I can not use this approach as the input XML is validated against several XSD files to check what format it is in, and it has to make sure required elements are present inside the input, and from what I understand CDATA makes it be ignored.
Document.xsd
<xs:element name="Document">
<xs:complexType>
<xs:sequence>
<xs:element name="DataA" type="DataAType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="DataB" type="DataBType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
DataA.xsd
<xs:complexType name="DataAType">
<xs:sequence>
<xs:element name="customer">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name" />
<xs:element type="xs:string" name="address" />
<xs:element type="xs:string" name="website" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="product" />
<xs:element type="xs:string" name="currency" />
</xs:sequence>
</xs:complexType>
In my Document.xsl I have
<xsl:output method="xml" indent="yes" encoding="utf8" />
<xsl:template match="/"> <!-- Matches Every Direct(no descendants) Child Node -->
<fo:root xsl:use-attribute-sets="paragraph-formatting">
<xsl:call-template name="layoutMaster" />
<xsl:apply-templates select="//*[local-name()='DataA']" />
<xsl:apply-templates select="//*[local-name()='DataB']" />
</fo:root>
</xsl:template>
DataA.xsl
<xsl:output method="xml" indent="yes" encoding="utf8" />
<xsl:template match="DataA">
<fo:page-sequence
master-reference="FirstAndRestMaster">
<fo:flow flow-name="xsl-region-body">
<fo:block white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve">
<xsl:text disable-output-escaping="yes">
<![CDATA[
</xsl:text>
<xsl:copy-of select="/*"/>
<xsl:text disable-output-escaping="yes">
]]>
</xsl:text>
</fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:template>
I tried following the answer in this previous question but found that it just printed "<![CDATA[ ]]>" into the PDF. I hoped it would work without needing to wrap some of the XML input as CDATA, as his input doesn't seem to have any CDATA in it. Would appreciate any help.