RE: [xsl] Assign if-test result value to a variable

Subject: RE: [xsl] Assign if-test result value to a variable
From: "Levesque, Gary R" <gary.r.levesque@xxxxxxxxxx>
Date: Wed, 27 Jul 2005 13:14:42 -0700
 Thanks for the responses... Still having problems getting this to work

I put the suggested code in place but when I process my xml file using
FOP or XSL Formatter I get the following error:

C:\FOP>fop.bat -xml revc.xml -xsl main.xsl -pdf revc-1.pdf
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[ERROR] javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException: javax.xml.transform.Transfo
rmerException: xsl:with-param is not allowed in this position in the
stylesheet!

Here is the code from my main template..

......

<xsl:for-each
select="//ApplicationData/Revision_Record[./RevisionLetter!='NEW']">
	<xsl:sort select="./RevisionLetter" order="ascending"/>
		<xsl:if test="position()=last()">

<!-- This grabs the block of data with the highest associated revision
letter and applies it to the template listed below. What I am attempting
to do is to "bank or store" the value of the highest revision letter in
a variable or param.  I further need to make the value of the variable
available within the "RevisionRecord" template that is being called
below.  -->

			<xsl:call-template name="RevisionRecord"/>
				<xsl:with-param name="revcache"
select="RevisionLetter" />
		</xsl:if>
</xsl:for-each>

.......

The following bit of code is from the template I am calling in
(RevisionRecord). I need to use the value of the variable or param
"revcache" as you can see below.


<xsl:template name="RevisionRecord">
	<xsl:with-param name="revcache" />

......

<fo:table-cell>
<fo:block keep-together="always" orphans="2" space-after="0.0pt"
space-before="45.0pt" display-align="center" text-indent="20.0pt"
white-space-collapse="false" widows="2">
<fo:inline font-family="Arial, sans-serif" font-size="18.0pt"
font-weight="bold">
	<xsl:value-of select="$dataSetNumberLabel"/>
	<xsl:value-of select="$dataSetNumber"/>
	<xsl:value-of select="$revcache"/>
</fo:inline>
</fo:block>

Thanks,
Gary

Current Thread