私はこのようなXML文書を持っている:現在のXSLTコンテキストから要素名を継承するにはどうすればよいですか?
<?xml version="1.0" encoding="utf-8" ?>
<article properName="Article">
<h1>
This <strong>is a header</strong>
</h1>
<p>This is a <strong>paragraph</strong</p>
</article>
私はこれにそれを変換する必要があります。
<?xml version="1.0" encoding="utf-8" ?>
<Article>
<Article-bigheader>
This <Article-bigheader-bold>is a header</Article-bigheader-bold>
</Article-bigheader>
<Article-paragraph>This is a <Article-paragraph-bold>paragraph</Article-paragraph-bold></Article-paragraph>
</Article>
元の文書内の要素は名前を変えていますし、さまざまな方法で入れ子にすることなので、私は可能なすべての組み合わせに対してxslテンプレートを作成する代わりに、これを動的に行う必要があります。私が問題を抱えている部分は、テキストの装飾です。その要素を含むXSLT要素の名前と "-old"の付いた要素を作成するにはどうすればよいですか? これは私がこれまで持っているものです:
<xsl:template match="/article">
<xsl:element name="{@properName}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="h1">
<xsl:element name="{concat(/article/@properName, '-', 'bigheader')}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
あなたは、XSLT 1.0または2.0を使用していますか? –