use variable in xslt


we can define global variable at the beginning:

<xsl:variable name="reviewTypeVar" select="/submission/submissionModel/dataValue[@fieldName = 'reviewPrograms']/@value"/>
 <xsl:variable name="reviewTimeVar" select="/submission/submissionMetadata/@submitedOn"/>

TO use the variable just use: $

	<!-- Root level template -->
	<xsl:template match="submissionModel">
			<xsl:if test="not(./dataValueGrid[@name=reviewHistoryList])">
				<dataValueGridAppendAndReplace name="reviewHistoryList">
					<row number="0">
						<dataValueAppendAndReplace fieldName="reviewRequestedDate">
							<xsl:value-of select="$reviewTimeVar" />
						<dataValueAppendAndReplace fieldName="reviewType">
							<xsl:value-of select="$reviewTypeVar" />
			<xsl:apply-templates />

not AND concat

use not() in the xls:if for negative:
<xsl:if test=”not(./dataValueGrid[@name=reviewHistoryList])”>….</xls:if>

use concat() for string concat, use “,” to seperate:
<xsl:value-of select=”concat(‘/Application/DirectFormAccess.jsp?requestInstance=’, $reviewInstanceIdVar)” />


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s