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>





Alta_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

topcat_ukCommented:
Hi,

You are on the right track!!

Your code is missing an /

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

Try

Your Code
<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" />


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
topcat_ukCommented:
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" />


0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.