0
XSLT를 사용하여 XML 문서를 구문 분석하려면 어떻게해야합니까? XSLT를 사용하여 XML 문서를 구문 분석 할 수 있습니까?XSLT를 사용하여 XML을 구문 분석 하시겠습니까?
<?xml version="1.0" encoding="utf-8" ?>
<cart>
<item id="1">
<name>Tyres</name>
<cost>20</cost>
</item>
<item id="2">
<name>Front Glass</name>
<cost>30</cost>
</item>
<item id="3">
<name>Vanity Mirror</name>
<cost>10</cost>
</item>
<item id="4">
<name>Brake Pads</name>
<cost>50</cost>
</item>
<item id="5">
<name>Brake Oil</name>
<cost>40</cost>
</item>
</cart>
과 XSLT 페이지 :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="shopping_cart">
<root>
<xsl:apply-templates select="cart"/>
</root>
</xsl:template>
<xsl:template match="cart">
<cart>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="cost">
<xsl:value-of select="cost"/>
</xsl:attribute>
</cart>
</xsl:template>
</xsl:stylesheet>
그렇게 할 수있는 방법 여기
은 XML 문서입니다? 파싱 컨셉에 대해 많이 알지 못하므로 안내하십시오.
"XSLT를 사용하여 XML 파일 구문 분석"을 의미합니까? 무엇을 성취하려고합니까? – vcsjones
글쎄 XSLT를 사용하여 XML 문서에서 특정 값을 가져 와서 코드에서 조작하고 싶습니다. – unknownsatan
XSLT는 XML 데이터를 다른 텍스트 파일로 변환하기위한 것입니다. 응용 프로그램에서 데이터를 사용하려면 LINQ to XML 또는 XmlSearilizer를 제안합니다. –