Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2005, 04:50 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

tokenize() is an XPath/XSLT 2.0 function, if it's not available then this is because you are running an XSLT 1.0 processor.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 26th, 2005, 04:53 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You're getting some bad advice here, I'm afraid.

Don't try writing "\" as "\\" in XSLT or XPath. Just because C and Java require a backslash to be escaped doesn't mean that other languages do.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 26th, 2005, 04:59 AM
Authorized User
 
Join Date: Apr 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi mhkay!

In I am using a forward slash then I don't use double slashes(\\). But if I am using backward slash, I have to use "\\" otherwise saxon8 throws the error. If any correction? please replay in next thread.



 
Old April 26th, 2005, 05:12 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT and XPath, "\" does not need to be escaped.

Of course, if you embed XSLT or XPath code as string literals within a language such as C or Java or JavaScript where backslahes need to be escaped, then you need to respect the conventions for writing string literals in those languages, just as you have to respect the XML escape conventions for characters such as & and < when you embed Javascript code within XSLT.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 26th, 2005, 05:23 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, I'm responding too hastily here. I was looking at

xsl:variable select="'c:\\test\\out.txt'"/>

This sets the variable to a string containing 17 characters. \\ represents two backslashes, not one. It's a valid string, but it's not the string c:\test\out.txt.

But in the next line,

<xsl:value-of select="tokenize($t, '\\')[last()]"/>

the second argument of tokenize is the string '\\', which is correct, because this argument is a regular expression, and the rules for regular expressions use "\" as an escape character.

However, it won't help the person who was trying to get an XSLT 1.0 processor to recognize the tokenize() function...



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with path for loading Pics (app.path) Tabbasum Beginning VB 6 2 November 15th, 2007 04:57 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
using app.path in database path and filename kd8con VB Databases Basics 2 October 25th, 2006 11:45 AM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
How to remove ? abdusalam Javascript How-To 1 July 27th, 2004 01:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.