Project

Profile

Help

Problem with the pattern "."

Added by Anonymous almost 20 years ago

Legacy ID: #2978106 Legacy Poster: Curtis (cdfisher07)

I am using the XSL engine in XMLSpy and it has obviously allowed me to do something that is not allowed. The following code: <xsl:variable name="level"> <xsl:number count="." level="multiple" format="1.1.1"/> </xsl:variable> generates an error in both the latest XALAN and Saxon builds Unexpected token in pattern, found "." Error at xsl:number on line 44 of file:/C:/Saxon/samples/test/tree-view.xsl: Looking the pattern up in MK's XSLT reference (2nd edition) on page 356, it appears as if this a valid Abbreviated Step that refers to the context node. What am I doing wrong here?


Replies (1)

RE: Problem with the pattern &quot;.&quot; - Added by Anonymous almost 20 years ago

Legacy ID: #2979238 Legacy Poster: Michael Kay (mhkay)

"." is not a legal pattern in either XSLT 1.0 or XSLT 2.0. The page reference is to the description of XPath expressions. Not every XPath expression is a legal pattern. If "." were a legal pattern, it would match everything. If you really want to match everything, you can use the pattern "node()|@*|/" - but I don't think you do. Michael Kay

    (1-1/1)

    Please register to reply