감사 : 사용자의 입력 XML 파일이 잘 형성해야
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="endpoint/@address">
<xsl:attribute name="address"><xsl:value-of select="replace(current(),'localhost','www.myhost.com')"/></xsl:attribute>
</xsl:template>
</xsl:stylesheet>
를 적어 둡니다. 다른 모든 노드를 포함하는 루트 XML 노드가 있어야합니다. 아래 내 테스트 소스 XML을 참조하십시오. 루트 노드 이름을 "xml"으로 정했습니다. 그리고 "system.serviceModel"노드에는 닫는 태그가 있어야합니다.
소스 XML :
<xml>
<system.serviceModel/>
<client>
<endpoint address="net.pipe://localhost/someservice"/>
</client>
</xml>
결과 XML :
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<system.serviceModel/>
<client>
<endpoint address="net.pipe://www.myhost.com/someservice"/>
</client>
</xml>
XSLT/XPath는 1.0)' 기능. – Tomalak