0
XML에서 XSLT 변환을 시도하고 있습니다. 책 내용을 변형하고 싶습니다. XML 파일이 있으며,이를 XSLT로 변환해야합니다. 모든 섹션의 템플릿을 만드는 것이 좋지만 XSLT에 대한 기본 경험 만 가지고 있으므로 적용 방법을 알지 못합니다.책 스타일의 XML에서 XSLT 변환
<book>
<section id="1">
<name>Heading First chapter</name>
<p><i/> some text </p>
<p> other text </p>
<subsection id="1.1">
<name>Heading second chapter</name>
<subsubsection id="1.1.1">
<name>Heading third chapter</name>
<p>some text</p>
</subsubsection>
</subsection>
</section>
</book>
같은 HTML은 내가 원하는입니다 :
<div>
<h1>1 Heading First chapter</h1>
<p><i>some text</i>
<p>other text</p>
<div>
<h2>1.1 Heading second chapter</h2>
<div>
<h3>1.1.1 Heading third chapter</h3>
<p>some text</p>
</div>
</div>
</div>
내 시도 :
<xsl:template match="/">
<body>
<xsl:for-each select="book">
<xsl:apply-templates select="."></xsl:apply-templates>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="p">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="p[i]">
<p>
<em>
<xsl:value-of select="."/>
</em>
</p>
</xsl:template>
<xsl:template match="section/name">
<p>
<h2>
<xsl:value-of select="."/>
</a>
</h2>
</p>
</xsl:template>
당신이 변화를 만드는 방법을 알고 있나요?
당신이 그 일을하지 않았다 무엇을하려고 했습니까? – Kilazur
mmy post를 업데이트했습니다. – dusan