This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
text() and not()
- From: "Andrew Welch" <andrew at thebristoldirectory dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 8 Jan 2002 10:21:16 -0000
- Subject: [xsl] text() and not()
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi all,
I have a problem with the default template, text() and an element within
another element.
<title>
Renew LP Piston Seal (Fig 5.5.1
<xref xrefid="F5.5.1" xidtype="FIGURE">
)
</xref>
</title>
I want this to output as:
Renew LP Piston Seal (Fig 5.5.1 xref )
where 'xref' will be replaced by a graphic.
I am overriding the default template using
<xsl:template match=text()/>
because there are several hundred elements that arent for display. However,
matching <xref> with a separate template and overriding the default template
in this way means 'xref' is moved outside the (fig). I have been told to
override the default template with a predicate to not include <title> and
use the default template to output the contents of <title>.
I have two points:
1. //*[not(name()='title')] matches all elements apart from the text in
<title>
//text()[not(name()='title')] matches all text, including that in
<title>
What xpath do I need to use to stop all text except that in <title>?
2. If I use the default template to output the contents of <title>, how do
I obtain the same sort of result as:
<xsl:template match="para0/title">
<p class="title"><xsl:value-of select="."/></p>
</xsl:template>
Something like:
<p class="title">
<xsl:apply-templates select="titleTemplate"/>
</p>
<xsl:apply-templates/>
(...and change match to name)
Thanks
Andrew.
(btw, I have been using xpath visualiser, is anyone interested in
implementing a 'reverse visualiser' or similar. Im sure I found one on the
web long ago that was a bit limited. A product like that has to be a
winner, right? :)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list