-2
我有一個xml,其中我必須將組件的屬性Id更改爲file1,file2,file3 .......並且還將ComponentRef更改爲file1,file2,file3 .. .. 組件和組件的提示是一樣的。通過XSLT遞歸更改屬性名稱
XML:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="WFA.Wire.Web.Content">
<Component Id="cat" Guid="{39081D95}">
<File Id="rtgfgfgfgf" >
</Component>
<Component Id="rat" Guid="{D878B422}">
<File Id="fgftyfthfhg" />
</Component>
<Directory Id="fhfhghjgjhj" Name="JavaScripts">
<Component Id="goat" Guid="{66CA28E3}">
<File Id="6576867" />
</Component>
<Component Id="tiger" Guid="{A2465A25}">
<File Id="97675" />
</Component>
</Directory>
<Directory Id="fghfghf" Name="StyleSheets">
<Component Id="cow" Guid="{4156E206}">
<File Id="123458" />
</Component>
<Directory Id="fhgfhg" Name="images">
<Component Id="ring" Guid="{DC55010C}">
<File Id="65432" />
</Component>
<Component Id="show" Guid="{CE5CA15B}">
<File Id="12345" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="WFA.Wire.Web.Content">
<ComponentRef Id="cat" />
<ComponentRef Id="rat" />
<ComponentRef Id="goat" />
<ComponentRef Id="tiger" />
<ComponentRef Id="cow" />
<ComponentRef Id="ring" />
<ComponentRef Id="show" />
</ComponentGroup>
</Fragment>
</Wix>
我必須將它更改爲
輸出:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="WFA.Wire.Web.Content">
<Component Id="file1" Guid="{39081D95}">
<File Id="rtgfgfgfgf" >
</Component>
<Component Id="file2" Guid="{D878B422}">
<File Id="fgftyfthfhg" />
</Component>
<Directory Id="fhfhghjgjhj" Name="JavaScripts">
<Component Id="file3" Guid="{66CA28E3}">
<File Id="6576867" />
</Component>
<Component Id="file4" Guid="{A2465A25}">
<File Id="97675" />
</Component>
</Directory>
<Directory Id="fghfghf" Name="StyleSheets">
<Component Id="file5" Guid="{4156E206}">
<File Id="123458" />
</Component>
<Directory Id="fhgfhg" Name="images">
<Component Id="file6" Guid="{DC55010C}">
<File Id="65432" />
</Component>
<Component Id="file7" Guid="{CE5CA15B}">
<File Id="12345" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="WFA.Wire.Web.Content">
<ComponentRef Id="file1" />
<ComponentRef Id="file2" />
<ComponentRef Id="file3" />
<ComponentRef Id="file4" />
<ComponentRef Id="file5" />
<ComponentRef Id="file6" />
<ComponentRef Id="file7" />
</ComponentGroup>
</Fragment>
</Wix>
謝謝邁克爾,我錯過了我的代碼命名空間(維克斯)的一部分。感謝您的回覆 –