-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>
谢谢迈克尔,我错过了我的代码命名空间(维克斯)的一部分。感谢您的回复 –