Being the ultimate mr. annoying (sorry :-) - I'd like to point out that class names starting with a digit shouldn't work (in a standards compliant browser, anyway), so if you're hpoing to style your <div> using the ID's as class names, I'd suggest you prefix them with a "c" or some other letter, e.g.:
Replace comma in id listing
New at xslt so this might be simple to everyone else...
I have the following page setup with subpages:
Products
-- Product 1
-- Product 2
-- Product 3
Category
-- Cat 1
-- Cat 2
-- Cat 3
Each product can belong to multiple categories, and i've added a checkbox under the product creation page where you select witch ones...
When i list witch categories each product belongs to, i get the id's of the category pages
(ex. 1080,1081,1093...)
But in my xslt i would like to remove the comma an replace it with a space (ex. 1080 1081 1093...) but i can't figure out how to do it...
<xsl:value-of select="produktKategori"/> lists the id's
and from what i have found this could do the trick:
<xsl:variable name="values" select="concat($currentPage/aliasOfCheckbox,',')"/>
<xsl:value-of select="umbraco.library:Replace($values, ',', ' ')" />
but where and what do i write to change it?
Hey,
It should just be
Rich
Damn that was quick...
...and it works :)
What i ultimately wanna end up wit is something like this:
<div class="<xsl:value-of select="umbraco.library:Replace(produktKategori, ',', ' ')" />">
<p>some content</p>
</div>
But alas no go... back to the drawing board
Got that working now :)
<xsl:variable name="classID"><xsl:value-of select="umbraco.library:Replace(produktKategori, ',', ' ')" /></xsl:variable>
<div class="{$classID}">
<p>some content</p>
</div>
Hi Crawn,
To do the inline XPath for the class attribute, you can do this:
Saves you storing it in a variable (unless you are going to use it again later on?)
Cheers, Lee.
Being the ultimate mr. annoying (sorry :-) - I'd like to point out that class names starting with a digit shouldn't work (in a standards compliant browser, anyway), so if you're hpoing to style your <div> using the ID's as class names, I'd suggest you prefix them with a "c" or some other letter, e.g.:
/Chriztian
is working on a reply...