Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323266

Summary: Use of $text doesn't parse correctly.
Product: [WebTools] WTP Source Editing Reporter: Eugene Marcotte <emarcotte>
Component: wst.xpathAssignee: Project Inbox <wst.xsl-inbox>
Status: CLOSED DUPLICATE QA Contact: Jesper Moller <jesper>
Severity: minor    
Priority: P3 CC: d_a_carver, thatnitind
Version: unspecified   
Target Milestone: 3.3 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Eugene Marcotte CLA 2010-08-20 11:47:17 EDT
Build Identifier: 20100617-1415

If you create a stylesheet, set the version to 2.0, and then make some sort of variable, param, etc of name='text', you will get a validation error any time you reference that variable in an XPath. If you set to version 1.0, there is no error reported. It doesn't really pose any problem other than marking the file as being in an error state. A simple fix is to just rename the variable and all is well. 

I don't know if this is a change between versions of XSLT's specification, but Saxon is able to handle this case without warnings.

Reproducible: Always

Steps to Reproduce:
1. Create a style sheet such as this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<xsl:variable name="text" select='"hello"' />
		<xsl:value-of select='$text' />
	</xsl:template>
</xsl:stylesheet>

2. Try to validate it
3. Observe the error on the $text
Comment 1 David Carver CLA 2010-08-21 19:38:24 EDT
This is actually an issue with the XPath 2.0 Processor.   text() is a reserved function name so the processor is getting confused.

Jesper we probably need to add text to the ever growing list of words to handle specially.
Comment 2 Jesper Moller CLA 2010-08-23 19:05:57 EDT
That's a good find, but luckily we already fixed that in bug 311480 (since it was general for all QNames).

So, it's available in 3.2.1 (which is only present in a separate WTP download location). If you got WTP with a Helios download, the fix  will be present in the Helios SR1 release (which for WTP is called 3.2.2).

Thank you for reporting!

*** This bug has been marked as a duplicate of bug 311480 ***