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

Fwd: Re: complex XPATH test

Subject: Fwd: Re: complex XPATH test
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 16 Jul 2001 19:11:45 -0400
whitley complex rockville md
Oops, I realized there's one bug... the equality test

$containing-block//text()[.=current()/following::text()]

(I also note typo in my code, missing ']')

isn't going to do the trick. You're going to need some kind of intersection. Like

$containing-block//text()[count(.|current()/following::text())=count(current()/following::text())]

which will really be horrible and slow, even if you put current()/following::text(), and its count, into a variable....

Anyone else? Heh,
Wendell


Date: Mon, 16 Jul 2001 19:03:24 -0400
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Subject: Re:  complex XPATH test

Adam,

<xsl:template match="br">
<!-- 1st, retrieve the block ancestor you're worried about -->
<xsl:variable name="containing-block" select="(ancestor::p|ancestor::li|ancestor::blockquote)[last()]"/>
<!-- (you'll have to extend that list to include all the possible blocks) -->
<!-- now, figure out what text nodes are actually following inside the block -->
<xsl:variable name="text-following">
<xsl:for-each select="$containing-block//text()[.=current()/following::text()">
<xsl:value-of select="."/>
</xsl:for-each>
<!-- now, include the br if there's anything there besides white space -->
<xsl:if test="normalize-space($text-following)">
<xsl:copy-of/>
</xsl:if>
</xsl:template>


(untested)

It's slow and painful, but then those <br> elements are painful too.

What do you think? I'd like to see a slick solution, too....


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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.