View Full Version : <div id="note{@style}">

12-08-2002, 05:22 PM
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">
<xsl:output method="html"/>
<xsl:param name="pmPage"/>
<xsl:param name="pmNum"/>
<xsl:param name="pmId"/>
<xsl:param name="pmTarget"/>

<xsl:param name="pmStyle">1</xsl:param>

<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:for-each select="paras/para">
<xsl:when test="position()=1">
<div class="noteH{@style}">
<xsl:value-of select="."/>
<xsl:when test="position()=last()">
<div class="noteB{@style}">
<xsl:value-of select="."/>
<div class="noteM{@style}">
<xsl:value-of select="."/>
<xsl:for-each select="liens/lien[@id=$pmId and @target=$pmTarget]">
<a href="{url}" class="lnkNote{@style}">
<xsl:value-of select="texte"/>

12-09-2002, 04:50 PM
into your first for_each

<xsl:variable name="st" select="@style"/>
<div id="note{$st}">