RE: [xml-dev] q on xpath 2.0 reserved functions

From
Michael Kay <>
To
'Ramkumar Menon' <>,
Date
2009-06-20T09:16:31Z
ID
<E97B36B593BD42958EF35948F75F7F14@Sealion>
Thread
RE: [xml-dev] q on xpath 2.0 reserved functions
A "-" in XPath is interpreted as a hyphen if it appears as part of a name;
if you want it interpreted as a minus sign then you need to insert a space.

Just as

   select="price - discount"

is different from

   select="price-discount"

so

   select="processing - instruction()"

is different from

   select="processing-instruction()"

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

> -----Original Message-----
> From: Ramkumar Menon [mailto:] 
> Sent: 20 June 2009 08:45
> To: 
> Subject: [xml-dev] q on xpath 2.0 reserved functions
> 
> Spec lists the following as reserved fn names.
> 
> attribute,comment,document-node,element,empty-sequence,if,item
> ,node,processing-instruction,schema-attribute,schema-element,t
> ext,typeswitch
> 
> Does this mean that user can register other "unprefixed" 
> xpath functions [custom ones].
> 
> If No, okay.
> If yes, quick, but naive Q.
> What if user defined an unprefixed function named 
> instruction(), or a function named sequence()?
> Lets say instruction() and sequence() functions return 
> numerical values.
> What would happen if the user performed the xpath on the 
> following doc.
> 
> <numberOfTasks>
>    <processing>20</processing>
>    ...
>     <empty>1</empty>
> </numberOfTasks>
> 
> xslt
> -------
> <xsl:template match="numberOfTasks">
>     <netValue><xsl:value-of 
> select="processing-instruction()"/></netValue>
>     <someValue><xsl:value-of select="empty-sequence()"/></someValue>
> </xsl:template>
> Whats the behaviour?
> Should this be explicitly disallowed?
> 
> I'll close my eyes and wait :-) Someone's gonna use a 
> sledgehammer on me :-)
> 
> Ram
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: 
> subscribe:  List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>