2012-06-01 60 views
0

現在我堅持簡單的任務。 我有 代碼:如何複製一個節點並更改另一個

<m:node1> 
... 
</m:node1> 
<namespace:something attribute1='1'/> 
<namespaceOther:other attribute1='2'/> 
<namespaceOther:some attribute1='1'/> 

所以,如果ATTRIBUTE1 = 1,我需要這樣的:

<m:node1> 
... 
</m:node1> 
<namespace:something attribute1='1'/> 
<namespaceOther:some attribute1='1'/> 

我需要做的就是複製<m:node1>其所有的兒童和檢查<namespace:* attribute1等於東西再複製它,否則不。

我想要類似<template match="*:*">但這是不可能的。 無法解決這個問題。

回答

1

這應該工作:

<xsl:copy-of select="m:node1" /> 
<xsl:copy-of select="*[@attribute1='1']" /> 
+0

謝謝回答。 – TerTer

相關問題