단일 속성을 변경하여 당신이 생각할 수있는 가장 간단한 XSLT는 단지이 경우, 최초의 값을 변환하는 /configuration/system.web/compilation/@debug
속성을 true
에서 false
에입니까?
는 XSLT
답변
이 변환 : 첫 번째 compilation
아이의 debug
속성을 수정합니다
<configuration>
<system.web>
<compilation debug="true" defaultLanguage="C#">
<!-- this is a comment -->
</compilation>
<compilation debug="true" defaultLanguage="C#">
<!-- this is another comment -->
</compilation>
</system.web>
</configuration>
이 원하는 정확한 결과를 생성 :이 XML 문서에 적용
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="system.web/compilation[1]/@debug">
<xsl:attribute name="debug">false</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
어떤 system.web
요소 (그러나 우리는 구성 파일에 하나의 system.web
요소가 있습니다. 우리가 보는 바와 같이 필요에 따라
<configuration>
<system.web>
<compilation debug="false" defaultLanguage="C#">
<!-- this is a comment -->
</compilation>
<compilation debug="true" defaultLanguage="C#">
<!-- this is another comment -->
</compilation>
</system.web>
</configuration>
는, 첫 번째 debug
atribute는 false
에 modifird된다.
이것은 XSLT에 대한 신원 패턴 변환이라고 불리며, @ Dimitre Novatchev가 지적했듯이 매우 강력합니다. – lavinio
'xsl : attribute' 엘리먼트는 바뀌는'xsl : template'과 일치하는 XPath에 이미 주어 졌을 때 변경 될 속성의 이름을 언급해야합니다. "이 애트리뷰트 설정"이라고 할 수있는 방법이 있습니까? –
@TomAnderson : 하나는 AVT 표기법을 사용할 수 있습니다 :'
<xsl:attribute name="debug">false</xsl:attribute>
<compilation>
? 아니면 나는 그 질문을 오해하고 있는가?
- 1. 는 XSLT
- 2. 는 XSLT 2.0
- 3. 는 XSLT - 분
- 4. XSLT - XSLT
- 5. XSLT
- 6. XSLT
- 7. XSLT
- 8. XSLT
- 9. 이 XSLT 들어 XSLT 처리
- 10. 는
- 11. XSLT 템플릿 일치 문제
- 12. xslt 정렬
- 13. Sandcastle xslt
- 14. XSLT 추상화
- 15. XSLT foreach
- 16. XSLT 가변
- 17. XML을 - XSLT
- 18. 사용하여 XSLT
- 19. XSLT 문제
- 20. XSLT HTML
- 21. XSLT 심화 콘텐츠 구조
- 22. XSLT XPath에서 '/ ..'표기법 사용
- 23. XSLT : Stylesheets 통합
- 24. JQuery 및 XSLT
- 25. xslt 코드 도움 필요
- 26. XSLT 언어를 독립적으로 만들기
- 27. XSLT 패스 노드
- 28. XSLT 및 XML 질문
- 29. XSLT 캐시 문제
- 30. xslt 배열 문제
좋은 질문 (+1). 간단하고 정확한 솔루션에 대한 내 대답을보십시오. Lucero의 대답은 현재 상당히 틀린 것입니다 - 그의 대답에 대한 저의 주석을보십시오. –