0
XSLT를 사용하여 DocBook 파일의 최상위 <book>
노드에 xml:id=foo
속성을 추가하고 싶습니다. 뭔가 효과가 있습니다 만, 이것을 구현하는 간단한 방법이 있는지 궁금합니다.XSLT : 최상위 노드에 xml : id 속성 추가
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:db='http://docbook.org/ns/docbook'
version='1.0'>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="db:book">
<xsl:copy>
<xsl:attribute name="xml:id">
<xsl:text>foo</xsl:text>
</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>