<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:php="http://php.net/xsl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="BackgroundReportPackage">
<!--- here i would like to add code like ---->
if ($dateofcharge < 7) {
return '
<xsl:for-each select="Charge">
<table class="special2" cellpadding="0">
<tr class="tr-border-bottom">
<td class="front-td-text" valign="top">Charge ID: </td>
<td class="minimalec">
<xsl:value-of select="ChargeId"/>
</td>
</tr>
<tr class="tr-border-bottom">
<td class="front-td-text" valign="top">Charge Type Classification: </td>
<td class="minimalec">
<xsl:value-of select="ChargeTypeClassification"/>
</td>
</tr>
</table>
';
} else {
do nothing
}
<!--- keep in mind that this code i've added is just for presentational purposes TO show you, how i want to use php code --->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
...私ができるなら、私は不思議とどのように私は私のXSLTテンプレート内のコードを含めることができます...私は
<xsl:choose>
を使用することができます知っているが、それは私のニーズを満たしていない、私は関数、変数などを追加したいです
誰でも助けることができますように!
あなたは確かに出力としてxsltを生成するPHPスクリプトを持つことができます。しかし、私はテンプレートの部分を評価するためにPHPでxsltテンプレート呼び出しをすることはできないと思います。 –
http://www.php.net/manual/en/xsltprocessor.registerphpfunctions.phpとhttp://php.net/manual/en/function.stream-wrapper-register.phpも参照してください。 'myvar:// variablename'のようなXML/XSLT内でも使用できます(これを行うビルドがある場合)。 – hakre
あなたはまだ回答を受け入れていません。あなたは、あなたが何を求めているのか、またその答えがあなたを満足させない理由を明確にしてください。 – Gordon