Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
hi all
i have a problem i trying to concat a link reference in xslt:
this is my code:
<xsl:element name="a" > <xsl:attribute name="class">metaNavItem noDecoration</xsl:attribute> <xsl:if test="./@newwindow = '1'"> <xsl:attribute name="target">_blank</xsl:attribute> </xsl:if> <xsl:choose> <xsl:when test="./@type = 'external'"> <xsl:attribute name="href"> <xsl:value-of select="concat('JavaScript:newPopup(',./@link,');')" /> <!--<xsl:value-of select="./@link"/>--> </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"> <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/> </xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:value-of select="./@title"/> </xsl:element>
that i want when type is external get the string in href attribute:
JavaScript:newPopup('http://mypage.com');
so my question is how can i set the apostrophe in concat function, i allready try with ' code
regards.
well i find the solution for this problem, i dont use the concant() function i replace thad code with this:
<xsl:text>JavaScript:newPopup('</xsl:text> <xsl:value-of select="./@link"/> <xsl:text>');</xsl:text>
now my problem is: the link open a new blank window....don“t open the window with the url,
if i put the link directly in my html code works perfectly, so what i have to do? some configuration or property missing?
my mistake!!!! daem!!
just delete attribute target....
code:
<xsl:element name="a" > <xsl:attribute name="class">metaNavItem noDecoration</xsl:attribute> <xsl:choose> <xsl:when test="./@type = 'external'"> <xsl:attribute name="href"> <xsl:text>JavaScript:newPopup('</xsl:text> <xsl:value-of select="./@link"/> <xsl:text>');</xsl:text> </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="href"> <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/> </xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:value-of select="./@title"/> </xsl:element>
Hi Cristian,
Heres a more readable way of doing the same thing:
<a class="metaNavItem noDecoration" href="{umbraco.library:NiceUrl(@link)}"> <xsl:if test="@type = 'external'"> <xsl:attribute name="href"> <xsl:text>javascript:newPopup('</xsl:text> <xsl:value-of select="@link" /> <xsl:text>')</xsl:text> </xsl:attribute> </xsl:if> <xsl:value-of select="@title" /> </a>
Since an element can not have duplicate attributes, the href attribute will just be overridden when necessary.
/Chriztian
ohh thanks Chiztian for you reply,
and yes its more redable. thanks!!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
concat javascript instruction with apostrophe in xslt
hi all
i have a problem i trying to concat a link reference in xslt:
this is my code:
<xsl:element name="a" >
<xsl:attribute name="class">metaNavItem noDecoration</xsl:attribute>
<xsl:if test="./@newwindow = '1'">
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="./@type = 'external'">
<xsl:attribute name="href">
<xsl:value-of select="concat('JavaScript:newPopup(',./@link,');')" />
<!--<xsl:value-of select="./@link"/>-->
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="./@title"/>
</xsl:element>
that i want when type is external get the string in href attribute:
JavaScript:newPopup('http://mypage.com');
so my question is how can i set the apostrophe in concat function, i allready try with ' code
regards.
well i find the solution for this problem, i dont use the concant() function i replace thad code with this:
<xsl:text>JavaScript:newPopup('</xsl:text>
<xsl:value-of select="./@link"/>
<xsl:text>');</xsl:text>
now my problem is: the link open a new blank window....don“t open the window with the url,
if i put the link directly in my html code works perfectly, so what i have to do? some configuration or property missing?
my mistake!!!! daem!!
just delete attribute target....
code:
<xsl:element name="a" >
<xsl:attribute name="class">metaNavItem noDecoration</xsl:attribute>
<xsl:choose>
<xsl:when test="./@type = 'external'">
<xsl:attribute name="href">
<xsl:text>JavaScript:newPopup('</xsl:text>
<xsl:value-of select="./@link"/>
<xsl:text>');</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="./@title"/>
</xsl:element>
Hi Cristian,
Heres a more readable way of doing the same thing:
Since an element can not have duplicate attributes, the href attribute will just be overridden when necessary.
/Chriztian
ohh thanks Chiztian for you reply,
and yes its more redable. thanks!!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.