Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Beginner working around variables

From: Howard Brazee <howard@------.--->
To: 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>
        &#160;MySequence: <xsl:value-of select="$MySequence" /> 
        &#160;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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent