2017-09-25 12 views
0

私はXSLTスタイルシートにいくつかの変換を行うXMLをいくつか持っていますが、どうやらxsl:for-eachは最初のノードをループします...XSLT xsl:for-eachは最初の行だけを返します

私はループトラフにすべてのノードを、それを期待し、それらを変換し、何とかそれだけでループしていますが

これは私のXMLです..私はここで間違ってやっているではないことを確認何最初の値を、トラフ

<?xml version="1.0"?> 
<email> 
    <uid>66</uid> 
    <subject>You have been added to a Priooo project</subject> 
    <message/> 
    <arguments> 
     <argument> 
      <name> 
       -url- 
      </name> 
      <value> 
       http://localhost/iaf4asap/#/resetpassword/c0a82001--6b0373de_15eb8270a5e_-7fea</value> 
      </argument> 
      <argument> 
       <name> 
        -inviteBy- 
       </name> 
       <value>Laurens Makel</value> 
      </argument> 
      <argument> 
       <name> 
        -project- 
       </name> 
       <value>[email protected]</value> 
      </argument> 
     </arguments> 
    <templateId> 
     c02f1e50-d569-41d9-87ec-933cded8a330 
    </templateId> 
</email> 

これは私のXSLTです:

私に次のような出力を与えている

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output omit-xml-declaration="yes" method="xml"/> 


    <xsl:template match="/email"> 
    <email> 
      <uniqueArguments> 
       <xsl:for-each select="arguments"> 
        <uniqueArgument> 
         <name><xsl:value-of select="argument/name"/></name> 
         <value><xsl:value-of select="argument/value"/></value> 
        </uniqueArgument> 
       </xsl:for-each> 
      </uniqueArguments> 
      <templateId> 
       <xsl:value-of select="templateId"></xsl:value-of> 
      </templateId> 
     </email> 
    </xsl:template> 

</xsl:stylesheet>  
..:

 <?xml version="1.0"?> 
<email> 
    <uniqueArguments> 
     <uniqueArgument> 
      <name> 
       -url- 
      </name> 
      <value> 
       http://localhost/iaf4asap/#/resetpassword/c0a82001--6b0373de_15eb8270a5e_-7fea</value> 
      </uniqueArgument> 
     </uniqueArguments> 
    <templateId> 
     c02f1e50-d569-41d9-87ec-933cded8a330 
    </templateId> 
</email> 

答えて

1

あなたは、一つのノードのみarguments XSLを上ループしている:それぞれがために、結果の多くのノードとXPathを必要と、代わりに使用します。

<xsl:for-each select="arguments/argument"> 
関連する問題