Because of the way Umbraco stores RichText content, you need to perform some trickery - I wrote a longer article about this here, which I'd recommend you took a look at.
You can absolutely do it like that (using string manipulation/RegEx) - but then should definitely create an extension method for it; First of all: It's really C# programming style which is not at all easily replicated with XSLT constructs, and second: You're gonna need to change that method a lot of times, but that's all implementation details the "view" shouldn't need to care about - all you want in the XSLT is something simple like:
Get all tags from RTE with xsl:for-each
Can I somwhow get specific tags from RTE field (the same way like I do with XML)?
For example, if I have RTE field "myRTE" with HTML:
<p>first line</p>
<p>second line</p>
How can I do something like:
<ul>
<xsl:for-each select="$currentPage/myRTE/p">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
Is that possible?
Hi Max,
Because of the way Umbraco stores RichText content, you need to perform some trickery - I wrote a longer article about this here, which I'd recommend you took a look at.
/Chriztian
Hi Chriztian!
Thank you for your reply! I will take a look at your post closer, but quick view seems to me a little bit complicated...
I thought about something, like:
- $replace = Replace('myRTE', '>', '>|')
- $split = Split($replace, '|')
- For-each($split/value) {...}
Something like this...
I did it with "Textbox" field, but don't know, what is the best (more or less the same) way with "RTE" field
Hi Max,
You can absolutely do it like that (using string manipulation/RegEx) - but then should definitely create an extension method for it; First of all: It's really C# programming style which is not at all easily replicated with XSLT constructs, and second: You're gonna need to change that method a lot of times, but that's all implementation details the "view" shouldn't need to care about - all you want in the XSLT is something simple like:
/Chriztian
is working on a reply...