i think the substring-before only gets part of the string before the actual p tag, and p tag not included? If so, use concat() xslt function to concat the first part (using substring-before) and the closing p tag.
Thanks for such a fast response. Dirk, you are right that the p end tag is not included and concat may be a good way to go but Neil's second response did the trick in the easiest way.
Neil, the first answer didn't work out because it strips out any text formatting but the second option works like a charge. Just surrounded that with p tags like so
Appending HTML to the end of a string
Hi all,
This is something I can do no problem in a template because I can just use an insertTextAfter attribute but I need this done in a macro.
I have the XSLT pulling out the first paragraph of text from an entry using the following code
It works perfectly except it does not close the paragraph tag so it throws alot of my alignment off and makes my code not validate.
I think I'm missing something simple in XSLT.
Any ideas?
Andrew,
Just in case... can you just put the paragraph tags around your xsl:value-of statement?
e.g.
That would still be valid xml / xslt
Sorry Ignore my previous post - I misread - just understood what you were trying to do...
I haven't tested this out and I'm not sure how well the umbraco.library:StripHtml function will work with unclosed tags:
One more last option:
umbraco.library:RemoveFirstParagraphTag
i think the substring-before only gets part of the string before the actual p tag, and p tag not included? If so, use concat() xslt function to concat the first part (using substring-before) and the closing p tag.
Does that help
Cheers,
/Dirk
Hi Everyone,
Thanks for such a fast response. Dirk, you are right that the p end tag is not included and concat may be a good way to go but Neil's second response did the trick in the easiest way.
Neil, the first answer didn't work out because it strips out any text formatting but the second option works like a charge. Just surrounded that with p tags like so
and it works perfectly.
Thanks!
is working on a reply...