Re: [xsl] using name() to generate a tag dynamically in xsl output - FOLLOW UP

Subject: Re: [xsl] using name() to generate a tag dynamically in xsl output - FOLLOW UP
From: mark bordelon <markcbordelon@xxxxxxxxx>
Date: Fri, 26 Feb 2010 11:38:49 -0800 (PST)
Thanks for the quick answer, Chris. I never knew to search there. Duhh.

So, my template would be ideally this.

<xsl:template match="word/../[@s_len&lt;5]">
<xsl:element name="{name()}">
	<xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
	<xsl:attribute name="text_title"><xsl:value-of select="/*/@title"
/></xsl:attribute>
	<xsl:apply-templates />
</xsl:element>
</xsl:template>

Experimenting with it lead me to a follow-up question.
Altova is complaining about any axis or axis-like syntax in my match
statement. I have also tried word/parent::**[@s_len&lt;0] and various others.
My idea is to get any node the parent of <word> with that condition of its
attribute.


--- On Fri, 2/26/10, Christopher R. Maden <crism@xxxxxxxxx> wrote:


From: Christopher R. Maden <crism@xxxxxxxxx>
Subject: Re: [xsl] using name() to generate a tag dynamically in xsl output
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Date: Friday, February 26, 2010, 11:15 AM


mark bordelon wrote:
> My question is then, how can I use name() to generate the context's tag name
in that template?
>
> I have tried composing it with <xsl:text>, but that does not work.
>
> Can someone point me in the right direction?

Use <xsl:element>.

~Chris
--
Chris Maden, text nerdB  <URL: http://crism.maden.org/ >
bThe honest man, though eber sae poor, Is king ob men for ab that.b
b Robert Burns, bIs There for Honest Povertyb
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319

Current Thread