Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - RE: Beginner working around variables >Thread Next - Re: Beginner working around variables Re: Beginner working around variablesTo: NULL Date: 8/3/2007 9:55:00 AM
On Fri, 3 Aug 2007 00:20:02 -0700, ML <ML@d...>
wrote:
>The other way around:
I keep seeing this, but I haven't yet "got" it. I'm an old
procedural programmer who has some old tricks to unlearn.
> <xsl:for-each select='key'>
> <xsl:variable name="MyName">
> <xsl:if test='. = "Name"'>
> <xsl:value-of select='../string[position() = 1]'/>
> </xsl:if>
> </xsl:variable>
> </xsl:for-each>
But I thought I would try it without understanding it, using the
following snippet. (I'm also trying to get a sequence # without
luck) (After I get it working, I will try to use templates the way I
use CoBOL paragraphs - sort of, something is obviously different)
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'>
<xsl:variable name="Sequence"> select='"1"'></xsl:variable>
<xsl:variable name="MyName" select='"1Two"'></xsl:variable>
...
<xsl:template match='dict'>
<xsl:for-each select='key'>
<xsl:variable name="MyName">
<xsl:if test='. = "Name"'>
<xsl:value-of select='following-sibling::*[1]'/>
</xsl:if>
</xsl:variable>
</xsl:for-each>
<xsl:variable name="MySequence"> select='$Sequence +1'></xsl:variable>
<xsl:variable name="Sequence"> select='$MySequence' ></xsl:variable>
 MySequence: <xsl:value-of select="$MySequence" />
 MyName(outside): <xsl:value-of select="$MyName" /> <br/>
The web page shows a thousand of the following lines:
MySequence: select='$Sequence +1'> MyName(outside): 1Two
MySequence: select='$Sequence +1'> MyName(outside): 1Two
MySequence: select='$Sequence +1'> MyName(outside): 1Two
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
