Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi to all,
I am trying to develop a xslt extension which returns datable. The datatable consists of two columns like
col A and col B. I would like to populate colA based on colB value.
How could I do this in xslt??
Is it possible to have datatable as return value in xslt??
praverity,
xslt extensions return xpathnavigator or simple types like string integer etc you cannot return a datatable. You can create xml representation of your data and return that as xpathnavigator.
Regards
Ismail
Thanks for your earlier reply.
I will work on it and let you know.
I found the solution. Here is the code snipet
private XPathNavigator getTagCloud() { var sqlHelper = DataLayerHelper.CreateSqlHelper(umbraco.GlobalSettings.DbDSN); umbraco.DataLayer.IRecordsReader resultSet = sqlHelper.ExecuteReader("select * from tagcloud"); XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("Tags"); XPathNavigator nav; doc.AppendChild(root); if (resultSet.HasRecords) { while (resultSet.Read()) { XmlElement ele = doc.CreateElement("Tag"); ele.SetAttribute("id", resultSet.GetInt("Id").ToString()); ele.SetAttribute("value", resultSet.GetString("value")); ele.SetAttribute("hitCount", resultSet.GetInt("hitCount").ToString()); root.AppendChild(ele); } nav = doc.CreateNavigator(); return nav; } else { return doc.CreateNavigator(); } }
Then in xslt i have
<xsl:for-each select="TagCloudHelper:GetTagCloud(10)/descendant-or-self::Tag">
<xsl:value-of select="@value"/>
<xsl:value-of select="@hitCount"/>
</xsl:for-each>
Now I could use the whole table values in my xslt.
Hope this help.
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
how to query datatable return from xsltextension in xslt
Hi to all,
I am trying to develop a xslt extension which returns datable. The datatable consists of two columns like
col A and col B. I would like to populate colA based on colB value.
How could I do this in xslt??
Is it possible to have datatable as return value in xslt??
praverity,
xslt extensions return xpathnavigator or simple types like string integer etc you cannot return a datatable. You can create xml representation of your data and return that as xpathnavigator.
Regards
Ismail
Ismail
Thanks for your earlier reply.
I will work on it and let you know.
I found the solution. Here is the code snipet
Then in xslt i have
<xsl:for-each select="TagCloudHelper:GetTagCloud(10)/descendant-or-self::Tag">
<xsl:value-of select="@value"/>
<xsl:value-of select="@hitCount"/>
Now I could use the whole table values in my xslt.
Hope this help.
Thanks
is working on a reply...