jas*_*ard 5 xml web-config transform
我正在摆脱web.config配置批处理文件(Hanselman's),并希望在vs2010中使用配置转换功能.但是,我在解决转换xml元素时遇到了一些麻烦(而不是元素上的属性).
这是我web.config的一个片段:
<Federation type="..." xmlns="...">
<SigningCertificate .../>
<AllowedAudienceUris>
<Audience>https://audience.url.com</Audience>
</AllowedAudienceUris>
</Federation>
Run Code Online (Sandbox Code Playgroud)
我想通过基于构建配置插入不同的URL来转换元素 - 这可以做到吗?
提前致谢!
/碧玉
Sco*_*aad -1
一种方法如下:
<!-- Copy all nodes -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- Operate just on the AllowedAudienceUris (copy it), setting the Audience element -->
<xsl:template match="/Federation/AllowedAudienceUris">
<xsl:copy>
<Audience>https://hello.com</Audience>
</xsl:copy>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)