9 users online. Create an account or sign in to join them.Users
XSLT and XPath Issue
This is an open discussion with 3 replies, filed under XSLT.
Search
Perhaps
<div>
<xsl:attribute name="class">
<xsl:apply-templates select="newtags/item" />
</xsl:attribute>
some infos here
</div>
...
<xsl:template match="newtags/item">
<xsl:value-of select="@handle" />
</xsl:template>
To make sure there are spaces between each class, you might need to do something like this:
<xsl:template match="/">
<xsl:apply-templates select="entry" />
</xsl:template>
<xsl:template match="entry">
<xsl:param name="tags-classes">
<xsl:apply-templates select="newtags/item" />
</xsl:param>
<div class="cols1 {$tags-classes}">
some infos here
</div>
</xsl:template>
<xsl:template match="newtags/item">
<xsl:value-of select="@handle" /><xsl:if test="position() != last()"><xsl:text> </xsl:text></xsl:if>
</xsl:template>
Yeah! Thats it! Thank your for the help!
Create an account or sign in to comment.
Hi Folks
last day I try to transform this:
<entry id="20"> <newtags> <item id="9" handle="webdesign" section-handle="tags" section-name="Tags">webdesign</item> <item id="10" handle="html-css" section-handle="tags" section-name="Tags">html/css</item> <item id="17" handle="typo3" section-handle="tags" section-name="Tags">typo3</item> </newtags> <title handle="ffmtipptopp">ffmtipptopp</title> </entry>into this:
tried it with:
<div class="cols1 {newtags/child::*/@handle}"> some infos here </div>but it doesent really helps. Can somebody help?