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

RE: why doesn't 'self::NODE' work?

Subject: RE: why doesn't 'self::NODE' work?
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 15 Apr 2003 09:33:27 -0400
xsl self node
[Wright, Steve]
>I am trying desparately to obtain the following input from 
> the below xml
> tree:
>
[snip]
> 
> This is the XPATH expression that I am using:
> --------------------------------------------------------
> <xsl:template match="PARA/LINK">
> 	<xsl:value-of select="self::LINK" />
> </xsl:template>
> --------------------------------------------------------
> 
> --------------------------------------------------------
> This is the (undesired) output that I am getting:
> --------------------------------------------------------
> Figure The Cell Membrane 3-3
> 
> --------------------------------------------------------
> 

In addition to the other answers you have received, let me add a few
things.  First of all, your template is not returning the results you
see.  It may very well not even be called.  Instead, your results are
being returned by the xslt default template, which returns the text
content of an element of there are no other templates available.

You can demonstrate this by adding a template that matches all elements
but does nothing -

<xsl:template match='*'/>

Of course, I had to make an assumption about how you were trying to
invoke your template, but when I added this null template, the output
vanished.

To work out the answer, you really have to say what you want to get.  We
have to assume that you want to ignore the text content of any elements
that are children of LINK.  Is that right?

You also have to make sure that your template gets invoked.  Assuming
that PARA is the document element (the top-level one), you could write 

<xsl:template match='/PARA'>
   <xsl:apply-templates/>
</xsl:template>

<xsl:template match="LINK">
	<xsl:copy-of select="text()" />
</xsl:template>

Even simpler would be 

xsl:template match='/PARA'>
   <xsl:apply-templates select="LINK/text()"/>
</xsl:template>

In these examples, the built-in default template does not get invoked
because you have provided a template to handle the nodes of interest.

What form you end up choosing would depend on what else you want to do
besides display the figure caption.

Cheers,

Tom P

 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.