using AND operator

Here should go questions about transforming XML with XSLT and FOP.
Posts: 7

using AND operator

Sat Jun 02, 2012 5:16 am


how can i get two recursive calls in my template to evaluate my constraint using the AND operator?

xml file structure:

<and> <!-- 2 conditions -->
<operator operation="="> <!-- condition1: get all subjects evaluatung to chemistry -->
<operator operation="<"> <!-- condition2: get all age < 70 -->


<xsl:template name="evaluateFilterML">
<xsl:param name="operator" />
<xsl:param name="input" />
<xsl:param name="value" />
<xsl:when test="$operator = 'equal'">
<xsl:value-of select="$input = $value"/>
<xsl:when test="$operator = 'not equal to'">
<xsl:value-of select="$input != $value"/>
<xsl:when test="$operator = 'less than'">
<xsl:value-of select="$input < $value"/>
<xsl:when test="$operator = 'greater than'">
<xsl:value-of select="$input > $value"/>

<xsl:template match="/">
<xsl:param name="currentyear" select="2012" />
<xsl:call-template name="evaluateFilterML">
<xsl:with-param name="operator" select="//filterML/constraint/and/operator[@operation='=']" />
<xsl:with-param name="input"> <!-- recursively evaluate input value -->
<xsl:apply-templates select="//citizensOfBritik/citizen/education/qualification[subject='chemistry']" />
<xsl:with-param name="value"> <!-- recursively evaluate condition value -->
<xsl:apply-templates select="($currentyear - (substring((dob),1,4))) < 70" />

--- so i need my stylesheet to output:
<xsl:apply-templates select="//citizensOfBritik/citizen/education/qualification[subject='chemistry']" /> AND <xsl:apply-templates select="($currentyear - (substring((dob),1,4))) < 70" />

Return to “XSLT and FOP”

Who is online

Users browsing this forum: Google [Bot] and 0 guests