I’m trying to develop a webpart for SharePoint, and it seems I need to learn XSLT to do it, modifying the itemsStyle.xsland customizing a contentquery.webpart.
I’m adding a templates to my current itemsStyle.xsl, here’s my current code :
I’m trying to make the output the whole XML files because I don’t know how it is formatted (I dunno where SharePoint takes it)
So far, I can output the attribute name trough name(), but text() return nothing :
<xsl:template name="printP" match="Row[@Style='printP']" mode="itemstyle">
<xsl:for-each select="@*">
Property:<xsl:value-of select="name()"/> |
Value:<xsl:value-of select="text()"/><br/>
</xsl:for-each>
</xsl:template>
Any other suggestion on how to figure out the XML format is welcome.
edit: removed useless part.
To output the value of an attribute node, use
select=".":text()selects any text nodes that are children of the current node. Only element nodes have text node children; attributes do not.However, if what you’re trying to do is copy the full input XML document to the output, unchanged, then throw all those templates away and use the identity transform:
This will copy everything through, unchanged (as XML, not text).