xsl-list
[Top] [All Lists]

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

2010-02-26 13:39:15
Thanks for the quick answer, Chris. I never knew to search there. Duhh.

So, my template would be ideally this.

<xsl:template match="word/../[(_at_)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::**[(_at_)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(_at_)maden(_dot_)org> wrote:


From: Christopher R. Maden <crism(_at_)maden(_dot_)org>
Subject: Re: [xsl] using name() to generate a tag dynamically in xsl output
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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 nerd  <URL: http://crism.maden.org/ >
“The honest man, though e’er sae poor, Is king o’ men for a’ that.”
— Robert Burns, “Is There for Honest Poverty”
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>