gpt4 book ai didi

xml - 检查 xml 文件是否存在 XSLT 2.0,saxon9HE

转载 作者:数据小太阳 更新时间:2023-10-29 01:48:17 26 4
gpt4 key购买 nike

我想用 xslt 2.0 检查文件是否存在。但是,它不起作用。我试过这个:

<xsl:choose>
<xsl:when test="doc(iri-to-uri(concat($currFolder, '/', $currSubFolder, '/', @href)))">

(路径正确)

但是,当文件不存在时,这会导致错误。

还有这个:

<xsl:choose>
<xsl:when test="doc-available(iri-to-uri(concat($currFolder, '/', $currSubFolder, '/', @href)))">

不起作用,它告诉我那里的文件显然不存在。

正确的做法是什么?一种检查 xml 文件是否存在的可靠方法。

最佳答案

根据 this similar question ,作者提到,就检查 xml 文件是否存在而言,诸如此类的东西对他们有用。

Right now, it checks each folder individually an if the file doesnt exist in that folder, it writes it to the output, regardless of whether it already exists in another previous folder.

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:variable name="currInput" select="tokenize(document-uri(.), '/')[last()]"/>
<xsl:choose>
<xsl:when test="doc-available(iri-to-uri(concat(.,'/',$currInput))) = fn:false()"></xsl:when>

关于xml - 检查 xml 文件是否存在 XSLT 2.0,saxon9HE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30577788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com