XSLT: "do this <xsl:value-of select="."/> times"

XSLT: "do this <xsl:value-of select="."/> times"

Post by Shea Marti » Thu, 23 May 2002 15:53:24



I have a global element called <cr>

<xs:element name="cr" type="xs:nonNegativeInteger" default="1"/>

If my XML file has <cr>3</cr>

I would like my XSLT file to convert this into <br/><br/></br>

I can't use for-each.  I have look at call-template and with-param, but
could not figure out how they might fit into this situation.

Anyone have ideas?

 
 
 

XSLT: "do this <xsl:value-of select="."/> times"

Post by Mark Sprou » Fri, 24 May 2002 01:03:45


Try

<xsl:template match="cr">
        <xsl:call-template name="cr2>
                <xsl:with-param name='repeat' select='.'/>
        </xsl:call-template>
</xsl:template>

<xsl:template name='cr2'>
        <xsl:param name='repeat'/>
        <br/>
        <xsl:if test='$repeat &gt; 1'>
                <xsl:call-template name="cr2>
                        <xsl:with-param name='repeat' select='$repeat
- 1'/>
                </xsl:call-template>
        <xsl:if>
</xsl:template>


>I have a global element called <cr>

><xs:element name="cr" type="xs:nonNegativeInteger" default="1"/>

>If my XML file has <cr>3</cr>

>I would like my XSLT file to convert this into <br/><br/></br>

>I can't use for-each.  I have look at call-template and with-param, but
>could not figure out how they might fit into this situation.

>Anyone have ideas?


 
 
 

1. <a href="<xsl:value-of select="FI"/>"> ????

I have this code:

      <DIV STYLE="font-weight:bold;">
             <a href="<xsl:value-of select="FI"/>">Click here to get the
file...</a>
      </DIV>

This is of course not correct coding but it illustrates what I want to do.
I have filenames in my XML database and want a report
with the filenames clickable.

Tried to find info about this in web3schools and www.xml.com
but with no results....

Stellan

2. HPFS386 & CACHE386???????

3. "<", ">","[","]" As XML Element Values ???

4. dhcpcd.log and dhcpcd.db

5. <xsl:sort order="ascending" select="$sortfield"/>

6. Upgrading Modem Driver whilst Connect = Problems

7. <xsl:output method="html" encoding="windows-1251"/> problem

8. PDC's and Active directory

9. ><xsl:value-of select="(number(firstNum) - number(thirdNum))div 2 "/>

10. Printing special characters, "&", "<", and ">"

11. <xsl: sort select="...."/> change value of select

12. <?import namespace="myns" implementation="myhtc.htc"/>

13. <name value="joe"/> vs. <name>joe</name>