目前我有这个php:
$xmlstrQs = '<QSHotel></QSHotel>';
$xmlqs = new SimpleXMLElement($xmlstrQs);
$xmlqs->addChild('Occupancies');
$xmlqs->Occupancies->AddChild('Occupancy');
$xmlqs->Occupancies->Occupancy->AddChild('Rooms', 1);
$xmlqs->Occupancies->Occupancy->AddChild('Adults', 2);
$xmlqs->Occupancies->Occupancy->AddChild('Childrens');
$myXmlqs = $xmlqs->asXML();
$myXmlqs = str_replace('<?xml version="1.0"?>', '', $myXmlqs);
$xslt->setParameter( '', 'qsHotel', $myXmlqs);
我需要将其作为 xml 或其他格式发送并在 xslt 中运行:
应该通过以下方式到达xslt:
<xsl:variable name="qsHotel">
<QSHotel>
<Occupancy>
<Rooms>1</Rooms>
<Adults>2</Adults>
<Childrens/>
</Occupancy>
</QSHotel>
</xsl:variable>
然后将其作为节点交叉
<xsl:for-each select="exsl:node-set($qsHotel)/QSHotel/Occupancies/Occupancy">