|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Interation and Variables
Here's an XSLT2 solution:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xsl:output method="text"/>
<xsl:variable name="vDoc" select="/"/>
<xsl:template match="/*/*[starts-with(name(),'Index')][last()]">
<xsl:for-each select=
"1 to xs:integer(substring-after(name(), 'Index'))">
<xsl:variable name="vName"
select="concat('Index', xs:string(current()))"/>
<xsl:value-of select="concat($vDoc/*/*[name()=$vName]/@Value,';')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Cheers,
Dimitre Novatchev
On Wed, 9 Feb 2005 11:16:54 -0000, Paulo Mendes Pinto
<paulo.pinto@xxxxxxx> wrote:
> Hello again
>
> Like I've said before, I'm new in XSL and because of that my mind is not
thinking like it.
>
> I'm transforming XML to Text plain file (CSV) and I have this XML:
> <IndexGroup>
> <Index1 ID="1" Value="Index1"/>
> <Index2 ID="2" Value="Index2"/>
> </IndexGroup>
>
> I have a XSL that transform to this
> Index1;Index2;
>
> Now I want this
> <IndexGroup>
> <Index3 ID="3" Value="Index3"/>
> </IndexGroup>
>
> To be transformed in this:
> ;;Index3;
>
> How can I do it ?
>
> I'm trying to do this without changing the XML, because is property of the
client and it's is difficult to change it. Can any one help me ??
>
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








