Subject: Fwd: Re: [xsl] complex XPATH test From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 16 Jul 2001 19:11:45 -0400 |
Anyone else? Heh, Wendell
Date: Mon, 16 Jul 2001 19:03:24 -0400 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Subject: Re: [xsl] 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] complex XPATH test, Wendell Piez | Thread | Re: : Re: [xsl] complex XPATH test, Jeni Tennison |
[xsl] SAXON and special characters, kfricovsky | Date | RE: [xsl] Background color problem , richard . whitley |
Month |