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

Push Processing

Subject: Push Processing
From: "Philip Vallone" <philip.vallone@xxxxxxxxxxx>
Date: Mon, 02 Mar 2009 09:14:16 -0500
 Push Processing
Hi List,

I am using push processing to output a resulting FO file. I use
apply-templates to build a table row and its cells. Normally I would build
the table by using a pull philosophy, but it would require a lot of rework
to the stylesheet. My problem occurs when I have an optional element. Using
apply-templates, my output my leave out a cell, causing my cell alignment to
be off. The below is a dumb-down version for example:

<item-entry>
	<item>
		<label>1</label>
		<code>234</code>
		<no>12345</no>
		<partno>12-3456-0981-1</partno>
		<name>Widget</name>
		<qty>3</qty>
	</item>
</item-entry>

Suppose I am missing <nsn>, I need to apply an empty cell. How can I do this
using push processing?

	<xsl:template match="item-entry">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="item">
		<fo:table-row>
			<xsl:apply-templates/>
		</fo:table-row>
	</xsl:template>
	<xsl:template match="label">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>
	<xsl:template match="code">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>
	<xsl:template match="nsn">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>
	<xsl:template match="partno">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>
	<xsl:template match="name">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>
	<xsl:template match="qty">
		<fo:table-cell>
			<fo:block>
				<xsl:value-of select="."/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>

Thanks,

Phil

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.