0
모든 요소 이름을 소문자로하고 모든 필드에 ID 필드를 제외한 모든 접두어를 추가하는 XSLT를 얻으려고합니다. id 필드가 복사되지 않는 것을 제외하면 모두 작동합니다.그대로 복사해야하는 것을 제외하고 모든 요소 이름에 접두사를 붙입니다.
은 여기 내 XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:template match="*">
<xsl:element name="theprefix_{translate(local-name(), $uppercase, $lowercase)}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()[not(self::unique_id)]"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{translate(local-name(), $uppercase, $lowercase)}" namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="comment() | text() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
감사합니다. 챔피언처럼 작동합니다. 템플릿 매칭이 어떻게 작동하는지 읽어야합니다. 나는 그들이 그런 식으로 떨어 졌다는 것을 전혀 몰랐다. – JvmSd121