[Home] [By Thread] [By Date] [Recent Entries]
At 2011-09-16 17:19 +0100, you wrote:
I have an XSL I use for identifying the XML - e.g. takes the XML and transforms it into another XML. This works as expected when it's XSLT. A user's vocabulary cannot simply be copied into an XSL-FO file, just in the same way it cannot simply be copied into an HTML file. How can I get the <xsl:copy> and <xsl:elements> working in FO, or something similar? By not using those instructions and translating your input into appropriate XSL-FO constructs. For example, match on your block-level constructs and use <fo:block>, and match on your inline-level constructs and use <fo:inline>. Above you are copying your input <xsl:template match="@*" > Unrelated to your question, the above can be replaced with: <xsl:template match="@*"><xsl:copy/></xsl:template> .... or even incorporated into a single template rule with: <xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>... but it is still inappropriate in your stylesheet to go to XSL-FO. The XSL-FO specification tells an engine to tolerate elements it does not recognize when those elements are not in the XSL-FO namespace, but it throws them and their content away. The HTML specification tells a browser to tolerate elements it does not recognize, but it still processes the content of that unrecognized element. Again, draw the parallel to HTML: if you used the identity transform in a stylesheet going to HTML, your end result would have <header> and <test> elements in the HTML and you wouldn't get a pretty print because a browser does not recognize your vocabulary. In HTML you have to build a document of <div> and <span> (or whatever HTML) from your XML. Similarly, when using XSL-FO you have to build a document of <block> and <inline> (or whatever XSL-FO) from your XML, because the engine does not recognize your vocabulary. I hope this helps. . . . . . . . . . . . Ken
|

Cart



