XSL - skipping tags

M

ma701ss

Hi,

I have searched everywhere for a solution to this - I'm sure it must b
a normal thing to do, but I can't find out.

All I want to do is apply a sylesheet to an XHTML file and only outpu
the data enclosed within certain tags. For example, I already have a
XHTML document and I might want to apply a stylesheet so that only dat
within <H1> tags is displayed in my browser.

Any help would be greatly appreciated.

Thanks,

Scot

ma701s
 
P

Patrick TJ McPhee

% All I want to do is apply a sylesheet to an XHTML file and only output
% the data enclosed within certain tags. For example, I already have an
% XHTML document and I might want to apply a stylesheet so that only data
% within <H1> tags is displayed in my browser.

You can do this with copy-of

<xsl:template match='h1'>
<xsl:copy-of select='.'/>
</xsl:template>

You'll also need to over-ride the default template for text nodes

<xsl:template match='text()'/>

and if you want well-formed xhtml, you'll need to include html and
body tags

<xsl:template match='html|body'>
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
 
M

Maarten Wiltink

[...]
All I want to do is apply a sylesheet to an XHTML file and only output
the data enclosed within certain tags. For example, I already have an
XHTML document and I might want to apply a stylesheet so that only data
within <H1> tags is displayed in my browser.

CSS has "display: none".

Groetjes,
Maarten Wiltink
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top