xsl-list
[Top] [All Lists]

[xsl] Select all heading tags

2008-12-30 00:06:52
Hi

I was wondering how I would be able to pick up headings from <sect> when I don't know what heading numbers will be used. What would be nice is to simply be able to say "select the tag which starts with a 'h' and ends in a number". Any idea how you would do this?

An example that obviously wont work is this:
XSL
...
<xsl:apply-templates select="h*" />
...
<xsl:template match="h*">
   <title>
        <xsl:value-of select="h*"/>
   </title>
</xsl:template>
...
XML Input
<root>
<sect>
   <h1>Heading 1</h1>
   <part>text</part>
</sect>
<sect>
   <h4>Heading 4</h4>
   <part>text</part>
</sect>
<sect>
   <h9>Heading 9</h9>
   <part>text</part>
</sect>
</root>

XML Output
<root>
<sect>
   <title>Heading 1</title>
</sect>
<sect>
   <title>Heading 4</title>
</sect>
<sect>
   <title>Heading 9</title>
</sect>
</root>

--~------------------------------------------------------------------
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>