Skipping xml entries with xsl

Discussion in 'XML' started by Andreas W. Wylach, Apr 15, 2004.

  1. Hello everybody,

    i got a problem in building a xsl construct to skip xml entries. Xml
    looks like this:

    ....
    <textblock>
    <text_crlf></text_crlf>
    <text_crlf></text_crlf>
    <text_crlf></text_crlf>
    <text_crlf></text_crlf>
    <text_crlf></text_crlf>
    <text_crlf></text_crlf>
    </textblock>
    ....

    Above xml code is a little part out of a whole xml tree. The problem
    i try to solve is to print out the first text_crlf tag (which will be
    translated in <br> via a match function. All the following text_crlf
    entries should be skipped, _if_ they are empty.
    I tried to work with following/preceding-sibling and such but can't get it
    to work.
    I am not very xml expirienced, so maybe one of you wizards can give me a hint
    how to get that problem solved.

    Greetings
    Andreas W. Wylach
    aw (at) ioc3.de
    Andreas W. Wylach, Apr 15, 2004
    #1
    1. Advertising

  2. Hello, Andreas!
    You wrote on 15 Apr 2004 01:55:32 -0700:

    AWW> i got a problem in building a xsl construct to skip xml entries. Xml
    AWW> looks like this:

    AWW> ...
    AWW> <textblock>
    AWW> <text_crlf></text_crlf>
    AWW> <text_crlf></text_crlf>
    AWW> <text_crlf></text_crlf>
    AWW> <text_crlf></text_crlf>
    AWW> <text_crlf></text_crlf>
    AWW> <text_crlf></text_crlf>
    AWW> </textblock>
    AWW> ...

    AWW> Above xml code is a little part out of a whole xml tree. The problem
    AWW> i try to solve is to print out the first text_crlf tag (which will be
    AWW> translated in <br> via a match function. All the following text_crlf
    AWW> entries should be skipped, _if_ they are empty.
    AWW> I tried to work with following/preceding-sibling and such but can't
    AWW> get it to work.
    AWW> I am not very xml expirienced, so maybe one of you wizards can give me
    AWW> a hint how to get that problem solved.

    <xsl:template match="text_crlf[1]">
    <br>
    </xsl:template>

    <xsl:template match="text_crlf[position() != 1 and . = '']"/>

    <xsl:template match="text_crlf[position() != 1 and . != '']">
    <!-- do some stuff here -->
    </xsl:template>

    With best regards, Alex Shirshov.
    Alex Shirshov, Apr 15, 2004
    #2
    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. Chris Vidal
    Replies:
    3
    Views:
    2,211
  2. Tommy Martin

    Forms Authentication and skipping a page

    Tommy Martin, Dec 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    332
    Tommy Martin
    Dec 15, 2003
  3. ma701ss

    XSL - skipping tags

    ma701ss, Jan 6, 2004, in forum: XML
    Replies:
    2
    Views:
    416
    Maarten Wiltink
    Jan 6, 2004
  4. Replies:
    1
    Views:
    3,596
    A. Bolmarcich
    May 27, 2005
  5. Don Bruder
    Replies:
    3
    Views:
    965
    spikeysnack
    Aug 3, 2010
Loading...

Share This Page