Thanks Ken,
Based on this template:
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
I was trying to construct in FO, but not quite there. I feel I am missing your
suggestion
<fo:flow flow-name="xsl-region-body">
<fo:table>
<fo:table-column column-width="200mm"/>
<fo:table-body border="1pt
solid red">
<fo:table-row
text-align="center">
<fo:table-cell>
<xsl:for-each select="node() | @*">
<fo:block>
<xsl:for-each select="@* | node()">
<fo:inline>
<xsl:value-of select="." />
</fo:inline>
</xsl:for-each>
</fo:block>
</xsl:for-each>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
Reagrds
Chris
-----Original Message-----
From: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com]
Sent: 16 September 2011 17:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSL:FO Identify Transforms
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.
However I need to make this work in the same work but using XSL:FO so
that it can be made pretty for print and outputted as a PDF.
I am sure this should be simple, and I am missing something obvious.
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>.
<xsl:template match="/ | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
Above you are copying your input
<xsl:template match="@*" >
<xsl:element name="attribute">
<xsl:attribute name="name">
<xsl:value-of
select="local-name()" />
</xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
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.
SAMPLE XML:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<header>
<test>This is test</test>
</header>
</xml>
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
--
Contact us for world-wide XML consulting and instructor-led training
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is powered by
MessageLabs. For more information on a proactive anti-virus service working
around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--