我有这样的XML:
<items>
<item>
<products>
<product>laptop</product>
<product>charger</product>
</products>
</item>
<item>
<products>
<product>laptop</product>
<product>headphones</product>
</products>
</item>
</items>
Run Code Online (Sandbox Code Playgroud)
我希望它输出像
laptop charger headphones
我试图使用,distinct-values()
但我想我做错了.谁能告诉我如何使用这个distinct-values()
?谢谢.
<xsl:template match="/">
<xsl:for-each select="//products/product/text()">
<li>
<xsl:value-of select="distinct-values(.)"/>
</li>
</xsl:for-each>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
但它给我这样的输出:
<li>laptop</li>
<li>charger</li>
<li>laptop></li>
<li>headphones</li>
Run Code Online (Sandbox Code Playgroud) 我正在尝试按日期对我的 xml 进行排序,但它不能像这样运行我的 xml 和 xsl r
<xsl:template match="/">
<xsl:for-each select="news/item">
<xsl:sort select="date1" order="descending" />
<xsl:value-of select="date1"/>
</xsl:for-each>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
MYXML
<news>
<item>
<date1>January 1, 2010</date1>
</item>
<item>
<date1>November 29, 2009</date1>
</news>
Its displaying the result but not in sorted way..
Run Code Online (Sandbox Code Playgroud) 我们如何通过代码检查列的字段类型是什么?例如,我知道"Country"是SharePoint中的一列,我正在访问它,但我不知道它的类型.如果有任何方法我可以以编程方式检查它然后执行一个动作,例如,如果它是一个查找字段,那么如果我想要它的值,我需要做... lookupvalue country ...或者如果它是一个文本字段,我可以简单地将其值作为字符串.
知道如何获得字段类型吗?
谢谢.
我想基于查询字符串动态caml查询.让我用例子解释一下
我的查询刺痛可以是任何东西
?cat=ABC&cat=ABD&cat=ABE...
?Cat=ABC
?Cat=ABC&cat=ABL
Run Code Online (Sandbox Code Playgroud)
所以不行.现在可以解决问题了
我想根据此查询字符串查询我的sharepoint列表
if (HttpContext.Current.Request.QueryString["cat"] != null)
{
string _cat = HttpContext.Current.Request.QueryString["cat"].ToString();
}
Run Code Online (Sandbox Code Playgroud)
所以这样我的字符串包含所有查询
string _cat=ABC,AD,....all.
Run Code Online (Sandbox Code Playgroud)
我想根据这些查询字符串和"AND"查询我的sharepoint列表
where title=ABC and title=AD ....
Run Code Online (Sandbox Code Playgroud)
如果只有一个查询字符串,那么只有title=ABC
....所以我希望我的查询字符串应该是动态的...任何想法如何实现这一点?
我想按日期对列表项进行排序:
我正在使用
<OrderBy><FieldRef Name='SortDate' Ascending='True'/></Order By>
Run Code Online (Sandbox Code Playgroud)
但是它给我的结果是随机的.如果没有那么可以按照CAML中的日期排序那么是否还有其他方法来检索基于日期排序的列表项....