Ale*_*lex 3 xslt templates copy mode
我需要复制一个节点及其子节点:
以下是要更改的摘录:
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="4"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
</Configuration>
Run Code Online (Sandbox Code Playgroud)
在第二个副本中,我需要将所有"Debug"更改为"Release"和一些属性值.
谢谢
谢谢Koynov
然而我找到了使用模板模式的解决方案:
<xsl:template match="Configuration[@Name='Debug|Win32']">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<xsl:copy>
<xsl:attribute name="WholeProgramOptimization">TRUE</xsl:attribute>
<xsl:apply-templates select="@*|node()" mode="Release"/>
</xsl:copy>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
使用此模板的所有属性:
<xsl:template match="@*" mode="Release">
<xsl:attribute name="{local-name()}">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="."/>
<xsl:with-param name="replace" select="'Debug'"/>
<xsl:with-param name="with" select="'Release'"/>
</xsl:call-template>
</xsl:attribute>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
当然还有"替换字符串"模板.
再次感谢.
| 归档时间: |
|
| 查看次数: |
1196 次 |
| 最近记录: |