XSL - skipping tags

Discussion in 'XML' started by ma701ss, Jan 6, 2004.

  1. ma701ss

    ma701ss Guest

    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
    -----------------------------------------------------------------------
    Posted via http://www.forum4designers.co
    -----------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message28906.htm
    ma701ss, Jan 6, 2004
    #1
    1. Advertising

  2. In article <4designers.com>,
    ma701ss <4designers.com> wrote:

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

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Jan 6, 2004
    #2
    1. Advertising

  3. "ma701ss" <4designers.com> wrote in message
    news:4designers.com...
    [...]
    > 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
    Maarten Wiltink, Jan 6, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Smith
    Replies:
    35
    Views:
    3,166
    Alex Kay
    Oct 24, 2004
  2. Stefano

    Skipping spaces between tags?

    Stefano, Aug 7, 2003, in forum: XML
    Replies:
    1
    Views:
    355
    Richard Tobin
    Aug 7, 2003
  3. Andreas W. Wylach

    Skipping xml entries with xsl

    Andreas W. Wylach, Apr 15, 2004, in forum: XML
    Replies:
    1
    Views:
    337
    Alex Shirshov
    Apr 15, 2004
  4. Replies:
    1
    Views:
    3,589
    A. Bolmarcich
    May 27, 2005
  5. Replies:
    0
    Views:
    543
Loading...

Share This Page