我想要特定的路径收集功能工作

时间:2017-03-06 07:20:28

标签: xslt

我想要特定的路径收集功能工作。

请检查并更正我的代码。

xml别名输入:

<folder_name>
<folder path="d:\123\2017_01_13"></folder>
<folder path="d:\123\\2017_02_14"></folder>
</folder_name>'

XSLT:

<xsl:variable name="hhhh" select="'file:///d:/list_of_files.html'"/>
<xsl:result-document href="{$hhhh}">
    <xsl:text>&#xa;</xsl:text>
    <xsl:for-each select="document('file:///d:/xslt_path.xml')//@path">
        <xsl:variable name="aa" select="//@path"/>
        <xsl:variable name="ajeet_1" select="concat('file:///', $aa)"/>
        <xsl:variable name="ajeet_coll" select="collection(concat(ajeet_1, '/?select=*.xml;recurse=yes'))"/>
        <xsl:for-each select="$ajeet_coll">
            <xsl:text>&#xA;</xsl:text>
            <xsl:text>&#xA;</xsl:text>
            <xsl:for-each select="//image">
                <xsl:value-of select="@xlink:href"/>
                <xsl:text>&#xA;</xsl:text>
            </xsl:for-each>
        </xsl:for-each>
    </xsl:for-each>
</xsl:result-document>

`

1 个答案:

答案 0 :(得分:1)

XSLT适用于URI,而不适用于文件路径。因此,如果您控制输入,请考虑使用例如<folder path="file:///d:/123/2017_01_13"></folder>。否则,您必须先将文件路径转换为URI:

<xsl:variable name="ajeet_1" select="iri-to-uri(concat('file:///', replace($aa, '\\', '/')))"/>

您还需要将<xsl:variable name="aa" select="//@path"/>改为<xsl:variable name="aa" select="."/>,因为您已经处理了该属性的for-each

相关问题