case problem in XSLT Options
lpastor
Posted: Monday, November 17, 2008 12:07:51 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
Hi

I have a folowing XSLT

Quote:

<xsl:variable name="jFun" select="/macro/JSfunction"/>
<xsl:variable name="clickName" select="/macro/clickName"/>
<xsl:variable name="top" select="/macro/top" />
<xsl:variable name="left" select="/macro/left" />
<xsl:variable name="visibility" select="/macro/visibility" />
<xsl:variable name="pointdirection" select="/macro/pointdirection" />


<xsl:template match="/">

<!-- start writing XSLT -->
<p>
<xsl:attribute name="id"><xsl:value-of select="$clickName"/></xsl:attribute>
<xsl:attribute name="style">top: <xsl:value-of select="$top"/>px; left: <xsl:value-of select="$left" />px; width: 21px; height:20px;z-index:2 ;position:absolute;visibility: <xsl:value-of select="$visibility"/> </xsl:attribute>
<xsl:attribute name="onclick">javascript:<xsl:value-of select="$jFun"/>;</xsl:attribute>

<xsl:variable name="pointdirection">
<xsl:choose>
<xsl:when test="<xsl:value-of select="$pointdirection"/>='left'">
<img src="/data/Assets/dvv/red-arrow-left.gif" />
</xsl:when>
xsl:when test="<xsl:value-of select="$pointdirection"/>='right'">
<img src="/data/Assets/dvv/red-arrow-right.gif" />
</xsl:when>
xsl:when test="<xsl:value-of select="$pointdirection"/>='top">
<img src="/data/Assets/dvv/red-arrow-top.gif" />
</xsl:when>
xsl:when test="<xsl:value-of select="$pointdirection"/>='bottom'">
<img src="/data/Assets/dvv/red-arrow-bottom.gif" />
</xsl:when>
</xsl:choose>
</xsl:variable>

</p>
</xsl:template>


my idea is according to pointdirection value to XSLT choose a different image
BUT something wrong in XSLT

???




Dirk
Posted: Monday, November 17, 2008 12:20:49 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
hi lpastor,

Have you checked the error message? Might give a clue, right?

Btw, I'm guessing you're assigning a variable twice. Don't think that is supported in xslt!

Code:
<xsl:variable name="pointdirection" select="/macro/pointdirection" />

and

<xsl:variable name="pointdirection">
<xsl:choose>
...
</xsl:choose>
</xsl:variable>


Btw 2: Not sure if following construct is xlst valid...

Code:
<xsl:when test="<xsl:value-of select="$pointdirection"/>='left'">


Why not using following construct?

Code:
<xsl:when test="string($pointdirection)='left'">


Regards,
/Dirk



level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
lpastor
Posted: Monday, November 17, 2008 12:23:55 PM

Rank: Aficionado

Joined: 8/4/2008
Posts: 111
Location: Serbia
resolved


<xsl:variable name="jFun" select="/macro/JSfunction"/>
<xsl:variable name="clickName" select="/macro/clickName"/>
<xsl:variable name="top" select="/macro/top" />
<xsl:variable name="left" select="/macro/left" />
<xsl:variable name="visibility" select="/macro/visibility" />
<xsl:variable name="pointdirection" select="/macro/pointdirection" />


<xsl:template match="/">

<!-- start writing XSLT -->
<p>
<xsl:attribute name="id"><xsl:value-of select="$clickName"/></xsl:attribute>
<xsl:attribute name="style">top: <xsl:value-of select="$top"/>px; left: <xsl:value-of select="$left" />px; width: 21px; height:20px;z-index:2 ;position:absolute;visibility: <xsl:value-of select="$visibility"/> </xsl:attribute>
<xsl:attribute name="onclick">javascript:<xsl:value-of select="$jFun"/>;</xsl:attribute>
<img>
<xsl:attribute name="src"> /data/Assets/dvv/red-arrow-<xsl:value-of select="$pointdirection"/>.gif </xsl:attribute>
</img>
</p>
</xsl:template>


Thnks Dirk
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.