0

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.

xslt code

1

2 Answers 2

1

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.

1
  • 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 B
    Commented Dec 20, 2016 at 10:02
0

Apperantly i forgot to place this line in my ItemStyle.xsl

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.