Subject: RE: [xsl] Are variables allowed in XPATHs? From: "Roger Glover" <glover_roger@xxxxxxxxx> Date: Mon, 3 Feb 2003 00:19:39 -0600 |
Harry Ohlsen wrote: > > It might help if you gave us a look at the exact pattern > > to which XMLSpy was objecting. > > Sorry, I thought the problem was pretty generic > and didn't want to muddy things by being too > specific. Ie, is it legal to use a variable in an > XPATH? The problem is that the situation is not that simple. In XSLT XPath *Expressions*, it certainly is legal to have variable values. You can verify this with examples from the following sections of the spec: http://www.w3.org/TR/xslt#attribute-value-templates http://www.w3.org/TR/xslt#variable-values http://www.w3.org/TR/xslt#message not to mention many, many other examples from the XSL FAQ: http://www.dpawson.co.uk/xsl/xslfaq.html However, XSLT XPath *PATTERNS* (often?) may not contain variable values. Patterns are the more restricted XPath syntax used in xsl:template/@match, xsl:key/@match, xsl:number/@count, and xsl:number/@from. See the spec here: http://www.w3.org/TR/xslt#section-Defining-Template-Rules I say "(often?)" above since the section on patterns says nothing about disallowing variables, and while the spec specifically prohibits variable and parameter values in the two "match" attributes above, it is silent about any such restriction on the "count" and "from" attributes of xsl:number. > Here's the code it's complaining about (apologies > for the line wrapping): > > <xsl:template name="delete-section" > match="/main/document/item[property[(name='report') > and (value=$sectionToDelete)]]"> > </xsl:template> So, it is very useful to see your specific case, since it falls into this latter category of patterns that cannot use variable values. Xalan should have flagged this as an error. -- Roger Glover glover_roger@xxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Are variables allowed in , Michael Kay | Thread | RE: [xsl] Are variables allowed in , Michael Kay |
RE: [xsl] N : M transformation, Roger Glover | Date | RE: [xsl] Are variables allowed in , Roger Glover |
Month |