一个排序取值的问题,请大家帮帮忙

dbase 2004-07-16 11:42:56
xml文件如下
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="cd.xslt"?>

<catalog>
<cd>
<title>3</title>
<artist>Bob Dylan</artist>
</cd>
<cd>
<title>1</title>
<artist>Bonnie Tyler</artist>
</cd>
<cd>
<title>2</title>
<artist>Bonnie Tyler</artist>
</cd>
</catalog>

想要在xls中取得title的最小值赋值给变量numbers
<xsl:variable name="numbers">
<xsl:for-each select="//title">
<xsl:sort data-type="number" select="." />
<number><xsl:value-of select="." /></number>
</xsl:for-each>
</xsl:variable>
得到的值是123,不知道如何取到1
在网上搜索到类似这样的写法
<xsl:for-each select="//title">
<xsl:sort data-type="number" select="." />
<xsl:item select="." />
</xsl:for-each>
</xsl:variable>

运行出错:不能在这里使用<xsl:item

肯请大家帮忙,谢谢

...全文
151 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dbase 2004-07-17
  • 打赏
  • 举报
回复
问题解决,谢谢思归了~
saucer 2004-07-17
  • 打赏
  • 举报
回复
try

<xsl:variable name="numbers">
<xsl:value-of select="/catalog/cd/title[not (. > /catalog/cd/title)]"/>
</xsl:variable>

>>运行出错:不能在这里使用<xsl:item

xsl:item is not valid in XSLT

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧