|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: why doesn't 'self::NODE' work?
[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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








