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

RE: Testing node immediately following in mixed conten

Subject: RE: Testing node immediately following in mixed content
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 15 May 2004 00:01:08 +0100
mixed node
The following-sibling::node() after your xref is a whitespace-only text
node. You need something like 

following-sibling::node()[not (self::text() and
normalize-space(.)][1][self::xref]

And if you think it's late on a Friday, it's early on Saturday here.

Michael Kay 

> -----Original Message-----
> From: Ryan Graham [mailto:Ryan.Graham@xxxxxxxxxxxxx] 
> Sent: 14 May 2004 22:21
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  Testing node immediately following in mixed content
> 
> Hi all,
> 
> It may be that it is late Friday, but for the life of me, I 
> cannot seem to
> get the following template to output a comma when the node immediately
> following the context node is a certain type.  Maybe my XPath 
> is wrong?
> 
> I basically want to split "back-to-back" xref's with a comma 
> (simulating
> multiple footnote references). My output is HTML.
> 
> Sample xml (that needs comma seperation):
> 
> <para>Some filler text
> 	<xref linkend="burnc01-note-0001"/>
> 	<xref linkend="burnc01-note-0002"/>
> completing the paragraph.</para>
> 
> Sample xml (that doesn't need a comma added)
> 
> <para>Some filler text
> 	<xref linkend="burnc02-note-0006"/> 
> 	some more filler text	
> 	<xref linkend="burnc02-note-0007"/>
> </para>
> 
> Stylesheet snippet:
> 
> <xsl:template match="para">
> 	<p>
> 		<xsl:apply-templates/>
> 	</p>
> </xsl:template>
> 
> <xsl:template match="xref">
> 	<a href="{concat('#',@linkend)}"><sup><xsl:value-of
> select="number(substring-after(@linkend,'note-'))"/></sup></a>
> 	<xsl:if test="name(following-sibling::node()[1]) = 'xref'">
> 		<sup>,</sup>
> 	</xsl:if>
> </xsl:template>
> 
> XmlSpy's xPath evaluator tells me that this is sound logic, 
> but using Saxon,
> I can't get the comma in the output.
> 
> Thanks,
> Ryan

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.