我有XML數據XSLT,FN:subsequance,Java轉換
<logData>
<log>
<id>1</id>
</log>
<log>
<id>2</id>
</log>
<log>
<id>3</id>
</log>
<log>
<id>4</id>
</log>
</logData>
我想只得到使用FN使用XSLT轉換日誌的一部分:子功能
這裏是我的XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:fn="http://www.w3.org/2006/xpath-functions" version="1.0" >
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/logData" >
<xsl:element name="log">
<xsl:copy-of select="fn:subsequence(./log, 2, 3)"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
我得到
ERROR: 'The first argument to the non-static Java function 'subsequence' is not a valid object reference.'
我正在使用Java轉換API,是Java SE 1.6的一部分。
你能幫我嗎?
那麼,我可以做什麼intend的子序列()? – Ilya 2012-07-31 13:11:06
@Ilya:這個答案完全爲您提供了您所要求的XSLT 1.0解決方案。 – 2012-07-31 13:14:46