Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - passing date parameter to an XSLT

 
Thread Tools Search this Thread
Old 09-21-2006, 08:06 PM   #1
Default passing date parameter to an XSLT


Hi
I am writing a wrapper over the XALAN XSLT engine, for transforming XML
documents. My problem is that I need to pass date as a parameter ( with
format mm/dd/yyyy hh.mm.ss) to the XSLT engine at run time (using the
api setStylesheetParam(char* key, char* expression)).

The first argument to setStylesheetParam is the key value and the
second argument is the date expression ( eg it may be like , char* exp
= "12/12/2006 12.12.00 "). But the call fails at run time with the
following error:

XPathParserException: Unexpected token.
expression = '09/22/2006 12.09.09'
Remaining tokens: ( '22' '/' '2006' '12.09' '.09') (, line -1, column
-1)

Now I have two questions:
1)What kind of data types can be handled insie an XSL stylesheet , I
mean when I write something like this
<xslaram name="day"></xslaram>
then can I also ensure that what kind of data type day will be?

Also what are the different kinds of data types supported in XSL.

2)Finally how do I pass my date expression as a parameter, without
failures.

I have a deadline to meet, and will be very grateful if you can help

Vaibhav



vaibhav
  Reply With Quote
Old 09-21-2006, 08:23 PM   #2
Joseph Kesselman
 
Posts: n/a
Default Re: passing date parameter to an XSLT

You might want to try "'09/22/2006 12.09.09'", in case Xalan is
interpreting the value as an XPath expression. (If so, the extra layer
of quoting will ensure it's taken as a literal string.)

>What kind of data types can be handled insie an XSL stylesheet


If you mean what kinds can you pass in as parameters... That's up to the
individual XSLT processor. Check its documentation to find out how it
handles this.

If you mean the types supported in XSL: Basically, the types defined by
the XPath specification, plus anything that specific XSLT processor adds
to support extension functions (these latter, of course, being
nonportable).

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
  Reply With Quote
Old 09-21-2006, 08:52 PM   #3
vaibhav
 
Posts: n/a
Default Re: passing date parameter to an XSLT

yeah that works ..tx a million..

Vaibhav

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump