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

Re: In Tears... (learning XPath)

Subject: Re: In Tears... (learning XPath)
From: "Christopher R. Maden" <crism@xxxxxxxxxx>
Date: Fri, 14 Jul 2000 12:02:21 -0700
xpath concat htm
At 11:45 14-07-2000 -0500, Jason A. Buss wrote:
I cannot, for the life of me, get the expression syntax correct.

concat(sect1,$sect1num,.htm)... failed.
concat("sect1",$sect1num,".htm")... failed.
concat("sect1"$sect1num".htm")... failed.
concat(sect1{,$sect1num,.htm}*)... failed.
concat(sect1,$sect1num,.htm*)... failed.

I know this is a newbie question, but I am stuck here.
The XPath spec uses concat(expression1,expression2,expression3*) as the
example...
The SAXON documentation shows concat(expression1{,expression2}*)...

I can't get either to work.

Both of those syntactic expressions are somewhat misleading. The XPath one means that concat() takes multiple expressions, separated by commas. The asterisk indicates that there should be two, and that the third one is not only optional but also repeatable (i.e., that there may be more than three arguments).


The SAXON documentation correctly observes that concat() can take one expression. The curly braces encapsulate both the comma and the second expression, and indicate that the encapsulation may be repeated.

Both are saying that concat() takes multiple arguments separated by commas.

The main problem you're having is with the nature of an expression. The variable part ($sect1num) is correct, since a variable reference is a valid expression. But the .htm for instance is wrong. A literal string expression must be surrounded by quotes: '.htm'. It's not clear whether sect1 is an XPath or a string. If it were a string, you'd want

concat('sect1', $sect1num, '.htm')

If sect1 is a path intended to get the value of the sect1 child of the current node, then you would do

concat(sect1, $sect1num, '.htm')

HTH,
Chris
--
Christopher R. Maden, Senior XML Analyst, Lexica LLC
222 Kearny St., Ste. 202, San Francisco, CA 94108-4510
+1.415.901.3631 tel./+1.415.477.3619 fax
<URL:http://www.lexica.net/> <URL:http://www.oreilly.com/%7Ecrism/>


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

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
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.