Link to home
Start Free TrialLog in
Avatar of Alta_
Alta_

asked on

Transforming many xml files via XSLT processor in PHP

Is it posible to process many xml files (to act like one)
via

$html = xslt_process$xsltproc, 'XMLfile.xml', 'XSLfile.xsl'); ?

I need this because the XML files are related and I need to extract data from all of them in the same time...with a single XSL file. (like a SQL join).

I tried to use in XSL file:

<xsl:apply-templates
select="document('relatedFile.xml')/RELATED_TAG">
</xsl:apply-templates>

but its not working.

I wonder if it is a way to make a global xml with a root node and append all the xml files as children of the root node...and then ...in the xsl file...to use

<xsl:apply-templates
select="root/RELATED_TAG">
</xsl:apply-templates>





ASKER CERTIFIED SOLUTION
Avatar of topcat_uk
topcat_uk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of topcat_uk
topcat_uk

Hi,

You are on the right track!!

Your code is missing an /

Your Code
<xsl:apply-templates
select="document('relatedFile.xml')/RELATED_TAG">

Try

<xsl:apply-templates
select="document('relatedFile.xml')/RELATED_TAG" />

*******************

I created a master XSL file which accepts a parameter for a default XML page.  This page is usually the default elements eg logo, header etc.

This is the parameter to accept the page.
<xsl:param name="DefaultPage" />

This is how I call it.
<xsl:apply-templates select="document($DefaultPage)/WebDocument/Elements" />