Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

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>





0
Alta_
Asked:
Alta_
  • 2
1 Solution
 
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
 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now