我有一个大致如下所示的 XML 文档:
<doc>
 <header> 
  Here is a header thing. 
 </header>  
 <docBody>
  Here is a long string of text in which other tags like <person>Me</person> appear. 
 </docBody> 
</doc> 
我的 XSL 看起来像这样:
<xsl:template match="header"> <!--get header stuff--> 
 <myHeader>
  <xsl:apply-templates/>  
 </myHeader> 
</xsl:template> 
<xsl:template match="docBody"> <!--get body stuff--> 
 <myBody> 
  <xsl:apply-templates/> 
 <myBody>  
</xsl:template> 
输出大致为:
<myHeader> 
   Here is a header thing. 
</myHeader> 
<myBody>
  Here is a long string of text in which other tags like Me appear. 
</myBody> 
<person>标签消失的地方。我注意到我可以做到
<xsl:template match="person">
 <myPerson>
  <xsl:apply-templates/> 
 </myPerson> 
</xsl:template> 
但是,由于我不明白的原因,当 php simplexml_load_string() 函数解析它时,我得到了这个输出,可能是因为它不包含子元素:
<myBody>
 Here is a long string of text in which other tags like appear. 
</myBody>
神秘地缺少<person>标签之间的文本。
我想输出的是:
<myBody> 
 Here is a long string of text in which other tags like Me appear. 
</myBody> 
<person> 
 Me
</person> 
有没有办法做到这一点?