Reputation: 1001
I'm trying to send a SQL string to URI resolver via XSLT document() function. The transformer fails when I use single quotes in it. Does anybody what to use in this sitation?
Here is the code from XSL file
<xsl:variable name="findFEV" select="document('sql:select md from MenuData md where md.id=194003 and string01='David' and md.account = :account')"/>
This is the error that I get when I run transformation.
15:59:12,165 ERROR [STDERR] javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXException: Expected ,, but found: David
15:59:12,165 ERROR [STDERR] javax.xml.transform.TransformerException: Expected ,, but found: David
15:59:12,166 ERROR [STDERR] at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:938)
15:59:12,167 ERROR [STDERR] at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
15:59:12,167 ERROR [STDERR] at org.tolven.api.rs.resource.DataExtractResources.transform(DataExtractResources.java:109)
15:59:12,167 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:59:12,167 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
15:59:12,168 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:59:12,168 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:606)
15:59:12,168 ERROR [STDERR] at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:186)
Upvotes: 0
Views: 674
Reputation: 109547
<xsl:variable name="findFEV"
select='document("sql:select md ... and string01='David' and ...")'/>
Explanation:
The select expression will become
document("sql:select md ... string01='David' and ...")
which fits. The document call needs a double quoted string as 'David'
has to be in single quotes (SQL).
Thanks to @DanielHaley
Upvotes: 1