XSLT에 정의 된 xml 파일에 템플릿 이름을 적용해야하는 C#으로 작성된 응용 프로그램이 있습니다.XSLT 템플릿 선택
예 XML :
<Data>
<Person>
<Name>bob</Name>
<Age>43</Age>
</Person>
<Thing>
<Color>Red</Color>
</Thing>
</Data>
예 XSLT는 :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="TargetName" />
<xsl:param name="RootPath" />
<xsl:Template Name="AgeGrabber">
<xsl:value-of select="/Person/Age" />
</xsl:Template>
<xsl:Template Name="ColorGrabber">
<xsl:value-of select="/Color" />
</xsl:Template>
</xsl:stylesheet>
내가 "/ 데이터/것"경로 템플릿 "ColorGrabber"를 실행하고 싶어하고 또 다른 템플릿 변환을 실행 말 "AgeGrabber"경로 "/ Data". 이것이 가능한가? 나는 경로와 템플릿 이름 (맨 위에 2 개의 매개 변수를 포함)을 전달할 수 있다고 생각하고 스위치 유형을 수행했지만 xsl : call-template은 매개 변수를 name 속성으로 사용할 수 없습니다.
이 동작을 어떻게 수행 할 수 있습니까?
변환의 예상 출력은 정확히 무엇입니까? – mzjn