You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Steven King <st...@eminence.com.au> on 2005/01/21 03:35:02 UTC

setStylesheetParam explaination

Hi,

When I add string name/value pairs to a XalanTransformer instance I need
to add " ' " around the parameter sent to it, why is this so?  So if a
value has a " ' " in it consequently dies and I dont think it should be
necessary to escape the apostrophe with a " \"'\" ".

What should I be doing? Is this expected behaviour?

I am using Xalan Version 1.6 and Xerces 2.3.

Thanks,

Steven King

-- 

<http://www.eminence.com.au/> Eminence Technology Pty Ltd
PO Box 118, Moorooka QLD 4105
Web: www.eminence.com.au <http://www.eminence.com.au/>
Ph: +61-7-3277-4100
Fax: +61-7-3277-4577


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


Re: setStylesheetParam explaination

Posted by Steven King <st...@eminence.com.au>.
Dave,

Thanks for the comments, understand that its an expression so nodes can 
be references in the source document as parameters but I only want to 
use parameters as string name value pairs.

I only just go back around to fixing this issue with our own XSL Api, I 
cannot find a setStyleSheetParameter method on the XalanTransformer that 
takes XObjectPtr or XString as parameters.  How do I go about creating 
the XObjects you speak of and pass them into the setStyleSheetParam?

Do I construct some XString objects and then pass them into 
setStyleSheetParam using the .str() method to return XalanDOMString 
objects? I have tried this and does not work.

I want to be able to pass in any string as a named parameter to our Api.

We are using the C++ port of Xalan, with version 1.6 of Xalan and 2.3 or 
Xerces.

Thanks,

Steve

 setStyleSheetParameter

david_n_bertoni@us.ibm.com wrote:

>>When I add string name/value pairs to a XalanTransformer instance I need
>>to add " ' " around the parameter sent to it, why is this so?
>>    
>>
>
>The value of a top-level parameter is an expression, so you only need to 
>do that if you want the parameter to be a string value.  If we didn't do 
>it this way, you would be limited to string literals only as top level 
>params.
>
>  
>
>>So if a value has a " ' " in it consequently dies and I dont think it 
>>    
>>
>should be
>  
>
>>necessary to escape the apostrophe with a " \"'\" ".
>>    
>>
>
>C++ style escape sequences are not going to work in XPath expressions. You 
>are encountering a general limitation in XPath string literals.  If you 
>want the ' character in a string literal, use the " character to delimit 
>the string literal.  If you want " in the string, delimit it with '.  If 
>you need both, you are out of luck, and you'll have to resort to creating 
>a string XObject instance, and using the other overload of 
>setStylesheetParam().
>
>Dave
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xalan-dev-help@xml.apache.org
>  
>
Dave




---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


Re: setStylesheetParam explaination

Posted by da...@us.ibm.com.
> When I add string name/value pairs to a XalanTransformer instance I need
> to add " ' " around the parameter sent to it, why is this so?

The value of a top-level parameter is an expression, so you only need to 
do that if you want the parameter to be a string value.  If we didn't do 
it this way, you would be limited to string literals only as top level 
params.

> So if a value has a " ' " in it consequently dies and I dont think it 
should be
> necessary to escape the apostrophe with a " \"'\" ".

C++ style escape sequences are not going to work in XPath expressions. You 
are encountering a general limitation in XPath string literals.  If you 
want the ' character in a string literal, use the " character to delimit 
the string literal.  If you want " in the string, delimit it with '.  If 
you need both, you are out of luck, and you'll have to resort to creating 
a string XObject instance, and using the other overload of 
setStylesheetParam().

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org