You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Stephane Dubon <sd...@yahoo.com> on 2000/03/31 16:56:38 UTC

xsl and variable

Hi,

I've been using before LotusXSL to process some
XML documents with a XSL one. In order to do so
I needed some flags to indicate me modifications
that I did.
So I used <xsl:variable> by setting a variable to
a value (0 for example) and then I was setting it
to another value (1 for example) when I had to do
some modifications.

Now my problem is that using latest Xalan version,
this no more works and I've checked that this should
have never work since xsl:variable are in fact
constants. So now how can I do the same thing as
before since I need a true variable ?

Thanks in advance,

Stephane DUBON

Following is my previous xsl code :

<xsl:variable name="flag34" select="0"/>

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

<xsl:variable name="product-value"
select="normalize-space(.)"/>

<!-- apply policy-rule34 -->
<xsl:if test="$product-value!='EMMENTHAL'">
        <xsl:variable name="flag34" select="1"/>
</xsl:if>
            
<xsl:if test="$product-value='EMMENTHAL'">
        <xsl:variable name="flag34" select="1"/>
</xsl:if>

</xsl:for-each>
            
<!-- apply policy-rule34 -->
<xsl:if test="$flag34='1'">
        Things to write when there is not
product-value
including EMMENTHAL
</xsl:if>

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: xsl and variable

Posted by "Chris P. McCabe" <ch...@choicehotels.com>.
Try something like:

<xsl:variable name="flag34">
   <xsl:choose>
      <xsl:when test="$product-value!='EMMENTHAL'">1</xsl:when>
      <xsl:otherwise>0</xsl:otherwise>
   </xsl:choose>
</xsl:variable>

Chris


Stephane Dubon wrote:

> Hi,
>
> I've been using before LotusXSL to process some
> XML documents with a XSL one. In order to do so
> I needed some flags to indicate me modifications
> that I did.
> So I used <xsl:variable> by setting a variable to
> a value (0 for example) and then I was setting it
> to another value (1 for example) when I had to do
> some modifications.
>
> Now my problem is that using latest Xalan version,
> this no more works and I've checked that this should
> have never work since xsl:variable are in fact
> constants. So now how can I do the same thing as
> before since I need a true variable ?
>
> Thanks in advance,
>
> Stephane DUBON
>
> Following is my previous xsl code :
>
> <xsl:variable name="flag34" select="0"/>
>
> <xsl:for-each select="value">
>
> <xsl:variable name="product-value"
> select="normalize-space(.)"/>
>
> <!-- apply policy-rule34 -->
> <xsl:if test="$product-value!='EMMENTHAL'">
>         <xsl:variable name="flag34" select="1"/>
> </xsl:if>
>
> <xsl:if test="$product-value='EMMENTHAL'">
>         <xsl:variable name="flag34" select="1"/>
> </xsl:if>
>
> </xsl:for-each>
>
> <!-- apply policy-rule34 -->
> <xsl:if test="$flag34='1'">
>         Things to write when there is not
> product-value
> including EMMENTHAL
> </xsl:if>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com

--
Chris P. McCabe  602-953-4416
Choice Hotels International  chris_mccabe@choicehotels.com



Re: how to code a space in a XSL stylsheet

Posted by "Chris P. McCabe" <ch...@choicehotels.com>.
Use &#160; instead.


Benoit Fouche wrote:

> Hi !
> Can someone told me how to code a space in a XSL stylsheet ? (to transform
> XML to basic HTML...)
>
> I tried this:
>
> <xsl:for-each select="menu">
>     titre:&nbsp;<xsl:value-of select="@title"/>
> </xsl:for-each>
>
> but my DOM (Micro$oft parser) objet is crashing (error '80070057'  wrong
> parameter Default.asp, line 12 )
>
> and that:
>
> <xsl:for-each select="menu">
>     titre:&amp;&nbsp;<xsl:value-of select="@title"/>
> </xsl:for-each>
>
> but it gave me that:    titre:&nbsp;Menu1
>
> What can I do so ?
> thanks for help...

--
Chris P. McCabe  602-953-4416
Choice Hotels International  chris_mccabe@choicehotels.com



Re: xsl question

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 6 Apr 2000, Alankar Chowdhury wrote:

> Hey guys,
> 
> question:
> 
> when I use the name() function like this
> 
> <xsl:value-of select="name()">
> I am able to extract the tag's name but what should I use to extract the data
> between the tags?
> 
> Example
> <sub>12345</sub>
> I can get the name of this tag by
> <xsl:value-of select="name()">
> but If i want to retrive "12345" what should I do :

<xsl:value-of select="."/>

This sort of question (XSLT related, not Xalan specific) really belongs on
mulberry tech's XSL list. I haven't seen anyone grump about this really
yet, but it probably should be mentioned given the rise in this type of
question recently.

- donald


xsl question

Posted by Alankar Chowdhury <al...@crtc.corp.mot.com>.

Hey guys,

question:

when I use the name() function like this

<xsl:value-of select="name()">
I am able to extract the tag's name but what should I use to extract the data
between the tags?

Example
<sub>12345</sub>
I can get the name of this tag by
<xsl:value-of select="name()">
but If i want to retrive "12345" what should I do :





how to code a space in a XSL stylsheet

Posted by Benoit Fouche <b....@cross-systems.com>.
Hi !
Can someone told me how to code a space in a XSL stylsheet ? (to transform
XML to basic HTML...)

I tried this:

<xsl:for-each select="menu">
    titre:&nbsp;<xsl:value-of select="@title"/>
</xsl:for-each>

but my DOM (Micro$oft parser) objet is crashing (error '80070057'  wrong
parameter Default.asp, line 12 )

and that:

<xsl:for-each select="menu">
    titre:&amp;&nbsp;<xsl:value-of select="@title"/>
</xsl:for-each>

but it gave me that:    titre:&nbsp;Menu1

What can I do so ?
thanks for help...