S
schaf
Hello NG !
I have a big problem.
I would like to go through a xml file in a xsl:for-each statement.
for-each entry (ID) in the XML file i would like to call an
xsl:function, which returns a number. This number i have to summarize
during the whole for-each statement. At the end i should have the sum
of the added numbers.
Like:
int sum;
for(int i = 0; i <= 10; ++i)
{
sum += i;
}
I tried like this, but it does not work, becasue an xsl:variable could
be set just once:
<xsl:function name="rsh:bestanden">
<xslaram name="kursTyp" as="xs:string"/>
<xslaram name="studiumTyp" as="xs:string"/>
<xsl:variable name="minPunkte"
select="$study-def/studium[@studiumID=studiumTyp]/studiumTeil[@studiumTeilID=$kursTyp]/ECTSPunkte"/>
<xsl:variable name="summeECTSPunkts"/>
<xsl:for-each
select="$study-def/studium[@studiumID=studiumTyp]/studiumTeil[@studiumTeilID=$kursTyp]/kursRef">
<xsl:variable name="kursID" select="@ref"/>
<xsl:variable name="kursNote"
select="rsh:noteByKursID($kursID)"/>
<xsl:if test="$kursNote != 'F'">
=>??? $summeECTSPunkte = $summeECTSPunkte +
rshunkteByKursID($kursID)
</xsl:if>
</xsl:for-each>
Thanks for help
regards
Marcel
I have a big problem.
I would like to go through a xml file in a xsl:for-each statement.
for-each entry (ID) in the XML file i would like to call an
xsl:function, which returns a number. This number i have to summarize
during the whole for-each statement. At the end i should have the sum
of the added numbers.
Like:
int sum;
for(int i = 0; i <= 10; ++i)
{
sum += i;
}
I tried like this, but it does not work, becasue an xsl:variable could
be set just once:
<xsl:function name="rsh:bestanden">
<xslaram name="kursTyp" as="xs:string"/>
<xslaram name="studiumTyp" as="xs:string"/>
<xsl:variable name="minPunkte"
select="$study-def/studium[@studiumID=studiumTyp]/studiumTeil[@studiumTeilID=$kursTyp]/ECTSPunkte"/>
<xsl:variable name="summeECTSPunkts"/>
<xsl:for-each
select="$study-def/studium[@studiumID=studiumTyp]/studiumTeil[@studiumTeilID=$kursTyp]/kursRef">
<xsl:variable name="kursID" select="@ref"/>
<xsl:variable name="kursNote"
select="rsh:noteByKursID($kursID)"/>
<xsl:if test="$kursNote != 'F'">
=>??? $summeECTSPunkte = $summeECTSPunkte +
rshunkteByKursID($kursID)
</xsl:if>
</xsl:for-each>
Thanks for help
regards
Marcel