2

我有一组 XML 文件(具体来说是 DocBook)。它们使用 XML 包含(又名 XInclude)来相互引用。给定这些 XML 文件之一,找出引用它的文件列表的最佳方法是什么?我正在寻找为该文件建立依赖关系树。换句话说,如果我更改给定的 XML 文件,我如何计算将受影响的其他 XML 文件的列表?

4

2 回答 2

4

在 DocBook SourceForge 项目的 SVN 存储库中,有一个 xmldepend.xsl 样式表模块。也许这就是您正在寻找的:

http://docbook.svn.sourceforge.net/viewvc/docbook/trunk/contrib/xsl/xmldepend/xmldepend.xsl

于 2010-12-30T18:27:04.967 回答
2

Given the one way relationships defined by XInclude, there isn't any direct XML based way to do this. Honestly, I would probably do a file search using find or grep.

You could, given the top level DocBook file, use a variant on the stylesheet that @mzjn pointed you at to generate all the dependencies in the compound document and then extract those where a document depends on the file you are currently interested in.

于 2011-01-04T12:56:10.543 回答