2017-03-30 05:47
浏览 75

使用XSLT merge 2 XML,它来自PHP transformToXML

I am beginner in PHP, XSLT. Found solution for transform XML using XSLT:

$xml = Array2XML::createXML('Document', $result);
$xsl = new DOMDocument;
$processor = new XSLTProcessor();
$results=$processor->transformToUri($xml,"NewTeema.xml" );

But, what to do if I have 2 or more XMLs? This $xml is not file, and I dont want to save each xml, like file on server (because it is was converted response json). Any ideas?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doudouxuqh198138 2017-03-30 07:49

    In the XSLT you can load additional document using the document() function.

    Another possibility is to register a PHP function that loads the file and returns the value or DOM node.

    点赞 打赏 评论
  • duanhe1965 2017-03-31 07:35

    Good solution, but I decided to merge 2 json, like this: json_encode(array_merge(json_decode($result, true),json_decode($resultProducts, true))); And the use = Array2XML::createXML('Document', $result);

    点赞 打赏 评论

相关推荐 更多相似问题