Re: [xsl] selecting all text between two nodes

Subject: Re: [xsl] selecting all text between two nodes
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 07 Sep 2005 09:41:22 +0200
Hi,

Tempore 07:11:11, die 09/07/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Lynn Alford <lynn.alford@xxxxxxxxxx>:

which means I want to open a ulink - copy all text that appears between the
<tx.hyperlink> and the <tx.hyperlink_end> then close the ulink.

I anwsered a very similar problem a few days ago (http://www.biglist.com/lists/xsl-list/archives/200509/msg00082.html)


Here's a solution that will fit your demands:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:output method="xml" />

<xsl:key name="hyperlink" match="node()"
    use="preceding::tx.hyperlink[1]/@id
	[.=current()/following::tx.hyperlink_end[1]/@begin]"/>

<xsl:template match="/">
  <xsl:apply-templates select="//tx.hyperlink" />
</xsl:template>

<xsl:template match="tx.hyperlink">
<ulink url="{locator_url/@protocol}:/{locator_url/@file_name}">
	<xsl:apply-templates select="key('hyperlink',@id)"/>
</ulink>
</xsl:template>

</xsl:stylesheet>


regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Gaudiam omnibus traderat W3C, nec vana fides

Current Thread