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

Template quitting too early?

Subject: Template quitting too early?
From: Larry Kollar <kollar@xxxxxxxxxx>
Date: Fri, 21 Nov 2003 20:31:36 -0500
quitting template
I have things mostly working, but I feel like I have a workaround here.
Using xsltproc... the file looks somewhat like this:

<section>
	<label>Top level</label>
	<section>
		<label>Second level</label>
		<p>Syntax: foo bar baz</p>
		<p>The actual file nests up to three deep in places.</p>
	</section>
</section>

And the relevant part of the XSLT:

<xsl:template match="section">
<section>
<xsl:apply-templates select="label" />
<xsl:if test="count(p) &gt; 0">
<xsl:variable name="str"><xsl:value-of select="p[1]" /></xsl:variable>
<xsl:choose>
<xsl:when test='starts-with($str, "Syntax:")'>
<xsl:apply-templates select="p[1]" mode="passthru" />
<xsl:apply-templates select="p[2]" mode="firstsentence" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="p[1]" mode="firstsentence" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:apply-templates select="section" />
</section>
</xsl:template>


This does what I want, but I'm not sure why I need the xsl:if -- without it, it
simply stops processing any sections that have no leading paragraphs
after the label. Is that expected behavior, or is there a boogly in xsltproc?
--
Larry Kollar k o l l a r @ a l l t e l . n e t
"The hardest part of all this is the part that requires thinking."
-- Paul Tyson, on xml-doc



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.