Hi Experts,
We are using CQWP in our application for fetching the data from PageLibrary.
We have used XSLT for formatting the fetched data and displaying it in the page.
As a part of adding more fields in the CQWP, we
Ø Created SiteColumn (e.g. internal name of site column is TestColumn) and added it in the PageLibrary
Ø We added the SiteColumn in the CQWP’s DataMappingViewFields property. Please see below highlighted portion which is the newly added SiteColumn
DataMappingViewFields="ItemDate,DateTime;Title,Text;TestColumn,Text"
Ø We did following changes in the existing XSLT file:
<xsl:template name="OuterTemplate.GetTestingData">
<xsl:param name="TestingData"/>
<xsl:value-of select="$TestColumn" disable-output-escaping="yes"/>
</xsl:template>
<xsl:variable name="TestColVal">
<xsl:call-template name="OuterTemplate.GetTestingData">
<xsl:with-param name="TestingData" select="@TestColumn"/>
</xsl:call-template>
</xsl:variable>
<div>
<xsl:value-of select="$TestColVal"/>
</div>
However, The value returned is blank here. Please let us know where we are going wrong as I am not the XSLT expert.
Appreciate early responses.
Regards,
Deepak
SOLUTION 1:
Use the below XSL template and check what are the internal names of all your fields. Use the internal names of these columns in your XSLT.
<xsl:template name="AllFields" match="Row[@Style='AllFields']" mode="itemstyle">
<xsl:for-each select="@*">
P:<xsl:value-of select="name()" />
<xsl:text>--</xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:for-each select="@*">
P:<xsl:value-of select="name()" />
<xsl:text>--</xsl:text>
</xsl:for-each>
</xsl:template>
Hope this helps.
Sample Reference:http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c57723c5-870b-4076-8c50-d1fa5cb94631
SOLUTION 2:
If you have verified your xslt and has no bugs... you need to export cqwp and edit exported xml of cqwp by adding additional field and its data type in commonviewfield tag..
Please refer: http://msdn.microsoft.com/en-us/library/aa981241.aspx
Regards,
Ankur
No comments:
Post a Comment