Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Use XSL:Variable

From: Ant&#xF3;nio Mota <amsmota@--------->
To:
Date: 2/1/2005 3:17:00 PM
Ora viva, i sempre bom encontrar um compatriota :)

I'm not one of the lists experts, there are many people here who
really excels in this area, making this one of the most useful lists
i've seen. But i can point some obvious things.

First, there are no "tags" in XSL, XSL works on "nodes" not on "tags".
So you work by selecting nodes, apllying temnplates on then, etc...

Second your var

>      <xsl:template match="ObjectFormat">
>           <xsl:variable name="FileExtention"><xsl:value-of
select="@FileExtention"/></xsl:variable>
>      </xsl:template>
>

exist only inside the template where you define it, so you can't use
it anywhere else. You'll have to define it  at the root level you want
it to be global. But it's not clear what you're trying to do, you
should post more info, along with examples of your XML . That template
like it is does nothing...

Fica bem...




On Tue, 1 Feb 2005 15:04:24 -0000, Paulo Mendes Pinto
<paulo.pinto@xxxxxxx> wrote:
> Hello
>
> I'm new at this List and new in XSL and I have many problems understanding
how to do something.
>
> I have a XML that I want to transform to in a CSV text file to import to
Excel. Until now I have the text file like I want with the char set that I
want but there is something that I want and I don't know how.
>
> In my XML I have a CONTROL tag with some information that I will use in the
other tags. Some of the tags in CONTROL tag will concatenate with some tags
along the rest the XML.
>
> I have to get some data from the CONTROL tag and save it in a variable and
use to concatenate with fields is another tag.
>
> How can I do that? I was trying to do like this.
>
>      <xsl:template match="CONTROL">
>           <xsl:apply-templates/>
>      </xsl:template>
>
>      <xsl:template match="ObjectFormat">
>           <xsl:variable name="FileExtention"><xsl:value-of
select="@FileExtention"/></xsl:variable>
>      </xsl:template>
>
> The FileExtention is an Attribute of Object Format tag in CONTROL.
>
> <xsl:template match="ObjectIndex">
>      <xsl:value-of select="@Code"/><xsl:text>;</xsl:text>
>      <xsl:value-of select="@Description"/><xsl:text>;</xsl:text>
>      <xsl:copy-of select="$FileExtention" /><xsl:text>|</xsl:text>
>      <xsl:text>&#xD;&#xA;</xsl:text>
> </xsl:template>
>
> With this XSL I get an error:
> Invalid variable referenceError in XPath expression. Invalid variable
reference
>
> How can I use this variable?
>
> Tkx in advance
>
> Paulo Aboim Pinto
> Engenheiro de Produto
> ======================
> DSTS - Desenvolvimento e Integragco de Servigos e Tecnologia, S.A.
> Tel.(+351)21 092 56 28
> Fax.(+351)21 092 56 29


transparent
Print
Mail
Digg
delicious
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