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

Axis specifers

Subject: Axis specifers
From: xslt.new <xslt.new@xxxxxxxxx>
Date: Mon, 15 Jan 2007 10:15:04 -0600
 Axis specifers
Hi:

I have written an xslt and am having issues with axis specifiers. I
will preent the sample input and xslt and explain the problem. Please
let me know where I am going wrong.

Sample XML:

<list>
<note><para>This is the first note.</para></note>
<note><para>This is the second note. </para></note>
<text><para>This is some text. </para></text>
</list>

XSLT:
<xsl:template match="note">
<xsl:choose>
			<xsl:when test="parent::list and position()=1">
</xsl:when>
<xsl:otherwise>
			<fo:list-block>
					<fo:list-item>
						<fo:list-item-label>
							<fo:block font-weight="bold">NOTE: </fo:block>
						</fo:list-item-label>
					<fo:list-item-body start-indent="body-start()" end-indent="0pt">
							<fo:block>
								<xsl:value-of select="."/>
							</fo:block>
						</fo:list-item-body>
					</fo:list-item>
				</fo:list-block>
	</xsl:otherwise>
		</xsl:choose>
</xsl:template>

<xsl:template match="note/para">
		<fo:inline border-left-width="0pt" border-right-width="0pt">
			<xsl:apply-templates select="node()"/>
		</fo:inline>
</xsl:template>

<!-- This is the template for list-->

<xsl:template match="list">
<xsl:if test="child::note">
<xsl:apply-templates select="note" mode="list"/>
</xsl:if>
</xsl:template>

<xsl:template match="note" mode="list">
		<fo:list-block>
			<fo:list-item>
				<fo:list-item-label>
					<fo:block font-weight="bold">NOTE: </fo:block>
				</fo:list-item-label>
				<fo:list-item-body start-indent="body-start()" end-indent="0pt">
					<fo:block>
						<xsl:value-of select="."/>
					</fo:block>
				</fo:list-item-body>
			</fo:list-item>
		</fo:list-block>
	</xsl:template>
	<xsl:template match="note/para" mode="list">
		<fo:inline>
			<xsl:apply-templates select="node()" mode="list"/>
		</fo:inline>
	</xsl:template>

My desired output is:


NOTE: This is the first note. NOTE: This is the second note. 1. This is some text.


However, what happens is after the processor checks for the first position of note, it just dumps the second note element on to the number '1' - that is number '1' and NOTE overlap and the styling gets messy.

Can anyone help me resolve this issue? How can I tell the processor
that after the first position of "note" check if there is another
"note" element and if it is, then that should also be displayed above
the text element on the output, following the first note element? So
irrespective of the number of "note" elements inside the <list>
element, they shoudl always be displayed above the <text> element as
shown in the desired output. Please give me any ideas and suggestions.

Thanks in advance for your help.

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.