Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-08-2002, 05:22 PM   PM User | #1
jeorg
Regular Coder

 
Join Date: Jul 2002
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
jeorg is an unknown quantity at this point
<div id="note{@style}">

I have this xsl file

I give a default value to a parameter pmStyle = 1

in my xml file I have <note page="panier" num="1" style="1">

then I want to change the style depending on this attributes

it works but only for my first element

with <div id="note{@style}"> I get <div id="note1">




but others

<div class="titreNote{@style}"> are all <div class="titreNote">

.... the {@style} doesn't work

do you know why ?

thank you

-------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xslaram name="pmPage"/>
<xslaram name="pmNum"/>
<xslaram name="pmId"/>
<xslaram name="pmTarget"/>

<xslaram name="pmStyle">1</xslaram>

<xsl:template match="/">

<xsl:for-each select="//notes/note[@page=$pmPage and @num=$pmNum]">
<div id="note{@style}">
<xsl:if test="titre/text()">
<div class="titreNote{@style}"><xsl:value-of select="titre"/></div>
</xsl:if>
<xsl:for-each select="paras/para">
<xsl:choose>
<xsl:when test="position()=1">
<div class="noteH{@style}">
<xsl:value-of select="."/>
</div>
</xsl:when>
<xsl:when test="position()=last()">
<div class="noteB{@style}">
<xsl:value-of select="."/>
</div>
</xsl:when>
<xsltherwise>
<div class="noteM{@style}">
<xsl:value-of select="."/>
</div>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="liens/lien[@id=$pmId and @target=$pmTarget]">
<a href="{url}" class="lnkNote{@style}">
<xsl:value-of select="texte"/>
</a>
</xsl:for-each>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
jeorg is offline   Reply With Quote
Old 12-09-2002, 04:50 PM   PM User | #2
angiras
Regular Coder

 
Join Date: Dec 2002
Location: France
Posts: 522
Thanks: 0
Thanked 0 Times in 0 Posts
angiras is an unknown quantity at this point
variable

into your first for_each

<xsl:variable name="st" select="@style"/>
<div id="note{$st}">
angiras is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:10 AM.


Advertisement
Log in to turn off these ads.