Problem with xml:variable in xsl:for-each

K

Konkee

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
 
J

Joris Gillis

Hi,

Tempore 10:17:05 said:
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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top