I wrote some xslt to make a new style for my content query web part, but it doesn't work. I'm new to xslt and don't know what i did wrong. I hoped that someone here could help me.
2 Answers
Firstly, don't tell us that something "doesn't work". Tell us how it fails. Error message? Wrong output? Give us a clue!
I don't know whether disable-output-escaping actually works in your particular environment, but even if it does, this is not the way to use the XSLT language. You are trying to create start and end tags "by hand", rather than using the language the way it is designed to be used, by constructing a tree of element nodes. Your attempt to create a start tag when processing the first sibling, and a matching end tag when processing the last, should be done something like this:
<xsl:template match="Rows">
<MessageForCEO>
<xsl:apply-templates select="Row"/>
</MessageForCEO>
</xsl:template>
<xsl:template match="Row">
<div>
....
</div>
</xsl:template>
Seeing a stylesheet liberally sprinkled with disable-output-escaping fairy dust is a sure sign of someone who hasn't really grokked what XSLT is all about. Do some reading.
-
I place the code i wrote in the ItemStyle.xsl file, so i know not all code is there. This is also how i learned it at my work.– Aline BCommented Dec 20, 2016 at 10:02
Apperantly i forgot to place this line in my ItemStyle.xsl
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">