Default value for params not working






Home Forums Ibis Adapter Framework Default value for params not working

This topic contains 5 replies, has 2 voices, and was last updated by Avatar Bastiaan 1 year, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2194
    Avatar
    Bastiaan
    Participant

    For an XSLT-pipe I want to use two params, filled with the contents of a sessionkey that may or may not have been set. As such, I want to give those params a default (well-formed xml) value. Unfortunately, the following does not work:

    <pipe name="TransformToOutput"
    	  className="nl.nn.adapterframework.pipes.XsltPipe"
    	  styleSheetName="../xsl/xsltsheet.xsl"
    	  getInputFromFixedValue="<dummy/>"
    	  xslt2="true"
    	  >
    	<param name="paramname1" sessionKey="sessionKey" defaultValue="<dummy/>" />
    	<param name="paramname2" sessionKey="sessionKey" defaultValue="<dummy/>" />
    	
    	<forward name="success" path="READY"/>
    </pipe>

    It leads to the following error:
    line [146]: Required item type of first operand of '/' is node(); supplied value has item type xs:string

    Anybody knows what causes this?

    • This topic was modified 1 year, 4 months ago by Avatar Bastiaan.
    #2195

    Hi Bastiaan, what does the XSLT look like?

    #2196
    Avatar
    Bastiaan
    Participant

    To clarify, the “<dummy/>” parts are escaped, but the forum appearantly automatically unescapes it.

    #2198
    Avatar
    Bastiaan
    Participant

    To part of the XSLT where it goes wrong:

    <xsl:param name="param1" />
    <xsl:param name="param2" />
    
    <xsl:template match="/">
    
    		
    <xsl:variable name="test1">
    	<root>
    		<xsl:choose>
    			<xsl:when test="($param1/RLY/ReturnCode='NOT_OK') or count($param1/dummy) > 0" />
    			<xsl:otherwise>
    				<xsl:choose>	
    					....element stuff goes here
    				</xsl:choose>
    			</xsl:otherwise>
    		</xsl:choose>
    	</root>
    </xsl:variable>

    Is it beacuse the when-clause inside the variable leads to an empty variable being set? As far as I know, this should be possible.

    #2199

    Ok , so what you are trying is reading an xpath out of the param. This is possible but only when your param is a DOM Object.

    http://maven.ibissource.org/iaf/apidocs/index.html nl.nn.adapterframework.parameters.Parameter states:

    attributes description default
    type
    • string: renders the contents of the first node (in combination with xslt or xpath)
    • xml: renders a xml-nodeset as an xml-string (in combination with xslt or xpath)
    • node: renders the CONTENTS of the first node as a nodeset that can be used as such when passed as xslt-parameter (only for XSLT 1.0). Please note that the nodeset may contain multiple nodes, without a common root node. N.B. The result is the set of children of what you might expect it to be…
    • domdoc: renders xml as a DOM document; similar to node with the distinction that there is always a common root node (required for XSLT 2.0)
    • date: converts the result to a Date, by default using formatString yyyy-MM-dd. When applied as a JDBC parameter, the method setDate() is used
    • time: converts the result to a Date, by default using formatString HH:mm:ss. When applied as a JDBC parameter, the method setTime() is used
    • datetime: converts the result to a Date, by default using formatString yyyy-MM-dd HH:mm:ss. When applied as a JDBC parameter, the method setTimestamp() is used
    • timestamp: similar to datetime, except for the formatString that is yyyy-MM-dd HH:mm:ss.SSS by default
    • xmldatetime: converts the result from a XML dateTime to a Date. When applied as a JDBC parameter, the method setTimestamp() is used
    • number: converts the result to a Number, using decimalSeparator and groupingSeparator. When applied as a JDBC parameter, the method setDouble() is used
    • integer: converts the result to an Integer
    • inputstream: only applicable as a JDBC parameter, the method setBinaryStream() is used
    • list: converts a List object to a xml-string ()
    • map: converts a Map object to a xml-string ()
    string

    So string is default and we want it to be a domdoc.
    The issue should be resolved by simply adding type=”domdoc” to the param:

    
    <param name="paramname1" sessionKey="sessionKey" defaultValue="<dummy/>" type="domdoc"/>" />
    
    #2204
    Avatar
    Bastiaan
    Participant

    Ah, that makes a lot of sense, it seems to work now. Thank you for your answer!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.