<i92agcad(_at_)uco(_dot_)es> wrote in message
news:1078316053(_dot_)4045cc153001f(_at_)www(_dot_)uco(_dot_)es(_dot_)(_dot_)(_dot_)
I have a template like this...
<xsl:template name="dibujaEje">
<line x1="16%" y1="85%" x2="16%" y2="15%"/>
<line x1="17%" y1="85%" x2="17%" y2="15%"/>
: : : :
<line x1="84%" y1="85%" x2="84%" y2="15%"/>
<line x1="85%" y1="85%" x2="85%" y2="15%"/>
</xsl:template>
The attributes of the element line, x1 and x2 change from 16% to 85%...
How i could simplify this and haven't to write all the lines?¿?
The following transformation uses the "scanIter" template from FXSL and
produces exactly the wanted result:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common"
xmlns:myFun="f:myFun"
exclude-result-prefixes="xsl ext myFun"
<xsl:import href="E:\xml\msxml\XML
SDK\Samples\Tests\Generic\FP\Fxsl\Exslt-Based\iter.xsl"/>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<myFun:myFun/>
<xsl:variable name="vmyFun" select="document('')/*/myFun:*[1]"/>
<xsl:template match="/">
<xsl:variable name="vrtfValues">
<xsl:call-template name="scanIter">
<xsl:with-param name="arg1"
select="69"/><!-- n -->
<xsl:with-param name="arg2" select="$vmyFun"/><!-- f -->
<xsl:with-param name="arg3" select="16"/> <!-- x -->
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="ext:node-set($vrtfValues)/*">
<line x1="{.}%" y1="85%" x2="{.}%" y2="15%"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="myFun:*">
<xsl:param name="arg1"/>
<xsl:value-of select="1 + $arg1"/>
</xsl:template>
</xsl:stylesheet>
Cheers,
Dimitre Novatchev
FXSL developer,
http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list