[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: displaying xslt using xsl:fo

Subject: RE: displaying xslt using xsl:fo
From: "bryan" <bry@xxxxxxxxxx>
Date: Thu, 14 Nov 2002 16:35:52 +0100
inline xslt call template
>Has anyone written a xsl:fo stylesheet to display xslt (or any kind of
>markup)?

>Its appears that fop is treating all the xslt and html mark up as
>instructions, almost as if it isnt namespace aware...  I've only
started
>on xsl:fo today (with the help Dave P's online book, cheers dave!) so
>any gentle looseners are appreciated.

Well you'd need to have a generic markup handler in the same way you
would need it if you wanted to display markup in your html.

At that point I guess it just becomes a question as to how do I want to
display markup when printing to a pdf, i.e a logic of presentation
question. Are there any parts of xslt markup that should be presented
differently than other parts. Probably you would want to have two
different types of block containers for 
xsl:template[@match] and xsl:template[@name]
then everything below that in the xsl namespace gets individual blocks,
everything not in the xsl namespace goes into one block with escaped
markup.

<xsl:template match="foo">
<bar/>
</xsl:template>

gets analyzed, without presentation properties of attributes, in this
way

<xsl:template match="xsl:template[@match]">
<fo:block-container><fo:block><xsl:call-template name="tagmatcher1"/>
</fo:block>
<xsl:apply-templates mode="genericmarkup"/>
<fo:block><xsl:call-template name="tagender1"/> </fo:block>
</fo:block-container>
</xsl:template>

<xsl:template name="tagmatcher1">
<fo:inline>&lt;</fo:inline><xsl:value-of select="name()"/> <xsl:for-each
select="@*"><fo:inline><xsl:value-of
select="name()"/></fo:inline>="<xsl:value-of
select="."/>"</xsl:for-each><fo:inline>&gt;</fo:inline>
</xsl:template>

<xsl:template name="tagender1">
<fo:inline>&lt;/</fo:inline><xsl:value-of
select="name()"/><fo:inline>&gt;</fo:inline>

</xsl:template>

<xsl:template match="*" mode="genericmarkup">
<fo:block><xsl:call-template name="tagmatcher1"/> </fo:block>
<xsl:apply-templates mode="genericmarkup"/>
<fo:block><xsl:call-template name="tagender1"/> </fo:block>
</xsl:template>

which would give you something like this(supposing I haven't made any
semantic mistakes above nor any keyboard entry errors below)

<fo:block-container>
<fo:block><fo:inline>&lt;xsl:template</fo:inline>
<fo:inline>match</fo:inline>="foo"<fo:inline>&gt;</fo:inline></fo:block>

<fo:block><fo:inline>&lt;</fo:inline>
bar<fo:inline>&gt;</fo:inline></fo:block>
<fo:block><fo:inline>&lt;/</fo:inline>bar<fo:inline>&gt;</fo:inline></fo
:block>

<fo:block><fo:inline>&lt;/</fo:inline>
xsl:template<fo:inline>&gt;</fo:inline></fo:block>
</fo:block-container>

this is similar to what I do with anything contained within a <code
type="markup"></code> node in my markup.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.