在 XSLT 3.0 中显示无效的 xpath,xslt,group-by,xslt-3.0"/>

首页 > 解决方案 > 在 XSLT 3.0 中显示无效的 xpath

问题描述

这个 xslt 有什么错误?它说 <xsl:copy-of select="current-group()"/> 行中的 xpath 无效,尽管当我使用 xslt 2.0 版(无流式传输)时它工作正常。

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wd="urn:com.workday/bsvc" 
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
    exclude-result-prefixes="xs"
    version="3.0">
    
    <xsl:mode streamable="yes" on-no-match="shallow-skip"/>
    
    <xsl:param name="BlockSize" as="xs:integer" select="2000"/>
    
    <xsl:strip-space elements="*"/>
    <xsl:output indent="yes"/>
    
   
    
    <xsl:template match="/">
        <root>
            <xsl:for-each-group select="root/wd:Get_Workers_Response/wd:Response_Data/wd:Worker" group-adjacent="floor((position() -1) div $BlockSize)">
                <group>
                    <xsl:copy-of select="current-group()"/>     <-- ERROR - Invalid Xpath
                </group>
            </xsl:for-each-group>            
        </root>
    </xsl:template>
    
</xsl:stylesheet>

在这里,我试图将 xml 中的工人列表分组为几组,每组 2000 名工人。

标签: xsltgroup-byxslt-3.0

解决方案


问题在于配置。禁用 xsl 验证器(窗口 > 首选项 > 验证)解决了这个问题。


推荐阅读