1
「我要重命名的XML文件。像old.xml與XSLT new.xml但我的代碼不能正常工作,請檢查。如何使用xslt重命名XML文件。我的代碼是
<xsl:for-each select="document('file:///d:/123/xslt_path.html')//@path">
<xsl:variable name="aa" select="."/>
<xsl:variable name="aaa" select="concat('file:///', $aa)"/>
<xsl:variable name="ajeet_1" select="iri-to-uri(replace($aaa, '\\', '/'))"/>
<xsl:variable name="ajeet_coll" select="collection(concat($ajeet_1, '/?select=*.xml;recurse=yes'))"/>
<xsl:for-each select="$ajeet_coll">
<xsl:if test="//citation=''">
<xsl:variable name="hhhh" select="'file:///d:/123/list_of_files.html'"/>
<xsl:result-document href="{$hhhh}">
<xsl:value-of select="replace(tokenize(document-uri(.), '/')[last()], '%20', ' ')"/>
<xsl:text>Citation Tag Empty</xsl:text>
</xsl:result-document>
</xsl:if>
<xsl:if test="//citation">
<xsl:variable name="aa1" select="node()"/>
<xsl:variable name="jaanam" select="replace(replace($aa1, '([^<>]+) : ([^<>]+)', '$1'), ' ', '_')"/>
<xsl:variable name="jaanam1" select="concat(replace(tokenize(document-uri(.), '/')[last()], '%20', ' '), '')"/>
<xsl:copy-of select="document($jaanam)"/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
提供關於在什麼包含更多細節 「文件:/// d:/123/xslt_path.html」 和你包含了什麼 「文件:/// d:/123/list_of_files.html」 – Rupesh
xslt_path .html: - d:\ 2017 \ working \ 003_March \ 2017_03_08 file:/// d:/123/list_of_files.html 寫錯誤 –
XSLT雖然可能是一種專用語言,一件事:轉換XML內容。考慮一種通用語言(Java,PHP,Python),它可以更輕鬆地迭代和運行操作系統文件系統更改,如重命名文件。 – Parfait