简体   繁体   中英

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?

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?

With XSLT you can use the document function in your code to read in additional files eg

<xsl:apply-templates select="document('file1.xml')//foo | document('file2.xml')//foo | document('file3.xml')//foo"/>

processes the foo elements in those three files.

If you have a file listing all input documents in the form of eg files.xml with

<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM