[英]Link multiple XML files to be viewed in a PHP
I was wondering is it possible to link multiple XML files so it can be displayed in a single PHP file? 我想知道是否可以链接多个XML文件,以便可以将其显示在单个PHP文件中?
I have multiple XML files, and wanted to know is there any particular code that can be used to link all the documents together without the need to combining all the XML files together? 我有多个XML文件,想知道是否有任何特定的代码可用于将所有文档链接在一起,而无需将所有XML文件组合在一起?
With XSLT you can use the document
function in your code to read in additional files eg 使用XSLT,您可以在代码中使用document
函数来读取其他文件,例如
<xsl:apply-templates select="document('file1.xml')//foo | document('file2.xml')//foo | document('file3.xml')//foo"/>
processes the foo
elements in those three files. 处理这三个文件中的foo
元素。
If you have a file listing all input documents in the form of eg files.xml
with 如果您有一个文件,以例如files.xml
的形式列出所有输入文档,
<files>
<file>file1.xml</file>
<file>file2.xml</file>
<file>file3.xml</file>
</files>
then 然后
<xsl:apply-templates select="document(document('files.xml')//file)//foo"/>
processes the foo
elements in all files listed in the files.xml
document. 处理files.xml
文档中列出的所有文件中的foo
元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.