[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: q on xpath 2.0 reserved functions

  • From: Ramkumar Menon <ramkumar.menon@gmail.com>
  • To: Michael Kay <mike@saxonica.com>
  • Date: Sat, 20 Jun 2009 02:42:30 -0700

Re:  q on xpath 2.0 reserved functions
Thanks MIke.
 
I am playing around with saxon and had a question on saxon 9.
 
The following is my XSLT.
  ....
  <test><xsl:value-of select="true+1"/></test>
  ...
 
The result is
 
<test xmlns:t="http://www.oracle.com">nan</test>
 
 
I change the xslt to
    <test><xsl:value-of select="true-1"/></test>
 
The result is
<test xmlns:t="http://www.oracle.com"/>
 
Why is this the case?
 
Ram

On Sat, Jun 20, 2009 at 2:16 AM, Michael Kay <mike@saxonica.com> wrote:

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:ramkumar.menon@gmail.com]
> Sent: 20 June 2009 08:45
> To: xml-dev@l...
> Subject: 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: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@l... List archive:
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>




--
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!

-Ramkumar Menon
A typical Macroprocessor


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.