XSLT tweak to exclude XML nodes required

Posted on 2006-05-02
Last Modified: 2012-06-27
Hello.  Hopefully this quite simple!

I am currently using the following XSLT to generate XHMTL from XML created from ADO recordsets:

<xsl:stylesheet xmlns:xsl="" version="1.0">
    <xsl:template match="/">
                <table class="report">
                    <xsl:apply-templates select="selectrows"/>
    <xsl:template match="selectrows">
          <TR class="header">
            <xsl:for-each select="selectrow[1]/*">
                <TD align="left">

                  <xsl:call-template name="replace-string">
                    <xsl:with-param name="text" select="name(.)"/>
                    <xsl:with-param name="replace" select="'_'"/>
                    <xsl:with-param name="with" select="' '"/>
                  <xsl:value-of select = "name(.)" />

        <xsl:apply-templates select="selectrow"/>

        <!-- Put  any footer information here <TD> and </TD> -->
        <TR class="footer">
          <TD>Total rows</TD>
          <TD class="int"><xsl:value-of select="count(//selectrow)" /></TD>
    <xsl:template match="selectrow">
            <xsl:for-each select="*">
                <td class="char"><xsl:value-of select="."/></td>

  <xsl:template name="replace-string">
    <xsl:param name="text"/>
    <xsl:param name="replace"/>
    <xsl:param name="with"/>

      <xsl:when test="contains($text,$replace)">
        <xsl:value-of select="substring-before($text,$replace)"/>
        <xsl:value-of select="$with"/>
        <xsl:call-template name="replace-string">
          <xsl:with-param name="text"
          <xsl:with-param name="replace" select="$replace"/>
          <xsl:with-param name="with" select="$with"/>
        <xsl:value-of select="$text"/>


What I would like to do is exclude certain rows (nodes) from the report.

For example, the first row of data in the XML I call "recordnumber" and this is a simple count.  How do I modify the line:
  <xsl:for-each select="selectrow[1]/*">

To skip the "recordnumber" data from the XML?

Thanks in advance!
Question by:colly92002
    LVL 52

    Accepted Solution


        <xsl:for-each select="selectrow[1]/*[not(name()='recordnumber')]">
    LVL 15

    Author Comment

    That seems to have worked.


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now