coderich Posted February 27, 2008 Share Posted February 27, 2008 Hey gang, I hope I have chosen the correct forum for this post - if not I truly apologize. I'm having trouble transforming a complex element. Everywhere I research it's stated that the solution is to use 'copy-of', and from the examples I see it does exactly what I want. The only problem is when I try to use it the order of my nested elements are output at the very end. I'm trying to transform elements that contain text and any number of other elements... right now I'm at a loss... any advice would be greatly appreciated. Example: xml <text>This is <b>my</b> complex element <i>example</i></text> xsl <xsl:template match="text"> <xsl:copy-of select="node()"/> </xsl:template> The output I get This is complex element<b>my</b><i>example</i> The output I want This is <b>my</b> complex element <i>example</i> Quote Link to comment https://forums.phpfreaks.com/topic/93264-xslt-problem-with-complex-elements/ Share on other sites More sharing options...
coderich Posted February 27, 2008 Author Share Posted February 27, 2008 *Booomf...* I realize its probably more accurate to say "Mixed XML Element" But the problem still remains. I'm using PHP 5.2.5 - my transformation logic looks like this: $xslt = new XSLTProcessor(); $xsl = new domDocument(); $xml = new domDocument(); $xsl -> load($xsl_file); $xml -> loadXML($xml_string); $xslt -> importStylesheet($xsl); return $xslt->transformToXml($xml); Quote Link to comment https://forums.phpfreaks.com/topic/93264-xslt-problem-with-complex-elements/#findComment-478131 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.