Problem with xml:variable in xsl:for-each

Discussion in 'XML' started by Konkee, Jul 6, 2005.

  1. Konkee

    Konkee Guest

    Hi!

    I have simple code to rebuild where is a lot of loops which looks like this
    one:

    <xsl:for-each select="TextBox">

    <xsl:if test="@dataSource='formUlicaOR'">

    {<xsl:value-of select="@text"/>}

    </xsl:if>

    </xsl:for-each>


    As You know reviewing document a lot of time to get one variable in each
    time is not good idea. But I can't do this in one loop, becouse this tags
    can be set in diferent position in each time.
    I tried to do something like this:

    <xsl:for-each select="TextBox">

    <xsl:if test="@dataSource='formUlicaOR'">

    <xsl:variable name="formNazwaOR" select="@text"/>

    </xsl:if>

    </xsl:for-each>


    But after end of for-each loop the veriables was unapproachable.

    If You can give me some advice what i should do - I will be thankful.


    Konki
     
    Konkee, Jul 6, 2005
    #1
    1. Advertising

  2. Konkee

    Joris Gillis Guest

    Hi,

    Tempore 10:17:05, die Wednesday 06 July 2005 AD, hinc in foro {comp.text.xml} scripsit Konkee <>:

    > I tried to do something like this:
    >
    > <xsl:for-each select="TextBox">
    >
    > <xsl:if test="@dataSource='formUlicaOR'">
    >
    > <xsl:variable name="formNazwaOR" select="@text"/>
    >
    > </xsl:if>
    >
    > </xsl:for-each>


    make the 'xsl:variable' element wrap the 'xsl:for-each':

    <xsl:variable name="formNazwaOR">
    <xsl:for-each select="TextBox">
    <xsl:if test="@dataSource='formUlicaOR'">
    <xsl:value-of select="@text"/>
    </xsl:if>
    </xsl:for-each>
    </xsl:variable>

    but I don't really get why the following code won't work:
    <xsl:variable name="formNazwaOR" select="TextBox[@dataSource='formUlicaOR']"/>

    regards,
    --
    Joris Gillis (http://users.telenet.be/root-jg/me.html)
    Spread the wiki (http://www.wikipedia.org)
     
    Joris Gillis, Jul 6, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Spam sucks
    Replies:
    1
    Views:
    414
    Spam sucks
    Jun 4, 2004
  2. Sparko
    Replies:
    0
    Views:
    422
    Sparko
    Jul 9, 2004
  3. Tjerk Wolterink

    xsl:for-each for each 3 elements problem

    Tjerk Wolterink, Nov 3, 2004, in forum: XML
    Replies:
    3
    Views:
    459
    Tjerk Wolterink
    Nov 3, 2004
  4. Replies:
    1
    Views:
    3,695
    A. Bolmarcich
    May 27, 2005
  5. cosmo
    Replies:
    0
    Views:
    1,454
    cosmo
    Oct 4, 2008
Loading...

Share This Page