[Last Call] Learn how to a build a cloud-first strategyRegister Now


XSLT tweak to exclude XML nodes required

Posted on 2006-05-02
Medium Priority
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="http://www.w3.org/1999/XSL/Transform" 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

Carl Tawn earned 200 total points
ID: 16586886

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

Author Comment

ID: 16586992
That seems to have worked.


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

825 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