Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)   Spam!  
Old August 13th, 2014, 05:17 PM
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XLST transform xml multiple query and display results in html table

I want to add headers for my html table for the following XLST query and only display once but for multiple queries:

Code:
<?xml version="1.0" ?>
 
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
 
<xsl:template match ="/" >
 
            <html>
 
              <head>
 
                        <title> title </title>
 
              </head>
 
              <body>
 
                        <xsl:apply-templates />
 
              </body>
 
            </html>
 
</xsl:template>
 
 
 
<xsl:template match="CMDBRelation" >
 
            <table width="400" border="1" >
 
                                                <tr>
 
<xsl:for-each select="To/CMDBObject/Properties" >
 
        <td> <xsl:value-of select="display_label" /> </td>      
        <td> <xsl:value-of select="root_class" /> </td>
 
 
 
</xsl:for-each>                                   
<xsl:for-each select="From/CMDBObject/Properties" >
 
                                    <td> <xsl:value-of select="resolver_group" /> </td>
 
                                    <td> <xsl:value-of select="supported_by" /> </td>
 
                                    <td> <xsl:value-of select="environment" /> </td>
 
                                    <td><th>  <xsl:value-of select="site_code" /> </th></td>
 
                                    <td> <xsl:value-of select="sla_classification" /> </td>
 
                                    <td> <xsl:value-of select="datacenter" /> </td>
 
 
 
 
 
</xsl:for-each>
 
                                    </tr>
 
            </table>
 
</xsl:template >
 
</xsl:stylesheet >
and that is the xml i am using the xlst for

Code:
<CMDBRelation>
        <identifier type="containment">8307958f5a00e7f735df5c197dcbab3e</identifier>
        <Properties />
        <From>
          <CMDBObject>
            <identifier type="infra_details">2bb729e0255d17ffd6fd2655a0339aa1</identifier>
            <Properties>
              <resolver_group type="STRING">Not Defined</resolver_group>
              <supported_by type="STRING" />
              <environment type="STRING">Production</environment>
              <site_code type="STRING">BRSP</site_code>
              <sla_classification type="STRING">Bronze</sla_classification>
              <datacenter type="STRING">Not Defined</datacenter>
            </Properties>
          </CMDBObject>
        </From>
        <To>
          <CMDBObject>
            <identifier type="node">93174788d73bc681d4e236d53ef447e3</identifier>
            <Properties>
              <root_class type="STRING">node</root_class>
              <display_label type="STRING">phbrsp-s3297</display_label>
            </Properties>
          </CMDBObject>
        </To>
      </CMDBRelation>|<CMDBRelation>
        <identifier type="containment">25fa93e9e5f2a34491c69b8f060362be</identifier>
        <Properties />
        <From>
          <CMDBObject>
            <identifier type="infra_details">69d01957564e4be3e1e825a6430ccea8</identifier>
            <Properties>
              <resolver_group type="STRING">Novartis:GL_APPS_XX:GL_EWS-APM-SUPPORT</resolver_group>
              <supported_by type="STRING" />
              <environment type="STRING">Production</environment>
              <site_code type="STRING">BRSP</site_code>
              <sla_classification type="STRING">Bronze</sla_classification>
              <datacenter type="STRING">Not Defined</datacenter>
            </Properties>
          </CMDBObject>
        </From>
        <To>
          <CMDBObject>
            <identifier type="node">4f1e38a3387715ef6548d555770eaa9b</identifier>
            <Properties>
              <root_class type="STRING">node</root_class>
              <display_label type="STRING">phbrsp-s3235</display_label>
            </Properties>
          </CMDBObject>
        </To>
      </CMDBRelation>|<CMDBRelation>
        <identifier type="containment">9261563a2722f9d157194e6ea3b041f9</identifier>
        <Properties />
        <From>
          <CMDBObject>
            <identifier type="infra_details">383c8681ef161e9e6f782f6e63780c3b</identifier>
            <Properties>
              <resolver_group type="STRING">Not Defined</resolver_group>
              <supported_by type="STRING" />
              <environment type="STRING">Production</environment>
              <site_code type="STRING">BRSP</site_code>
              <sla_classification type="STRING">Bronze</sla_classification>
              <datacenter type="STRING">Not Defined</datacenter>
            </Properties>
          </CMDBObject>
        </From>
        <To>
          <CMDBObject>
            <identifier type="node">5a785cd5bb2d0494a85ebf38b41d2af6</identifier>
            <Properties>
              <root_class type="STRING">node</root_class>
              <display_label type="STRING">brsptsm01</display_label>
            </Properties>
          </CMDBObject>
        </To>
      </CMDBRelation>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display last half of XML document using xlst AayushN XSLT 1 June 23rd, 2016 05:34 AM
XLST transform xml multiple query and display results in html table tatetiffany Forum and Wrox.com Feedback 1 April 9th, 2015 06:32 AM
XLST transform xml multiple query and display results in html table tatetiffany XSLT 0 August 13th, 2014 05:28 PM
XLST noob - XML -> XML transform help required Crass1968 XSLT 6 March 4th, 2010 06:32 AM
transform a xml to a html table robert_trudel_fr XSLT 3 December 3rd, 2006 01:16 PM



All times are GMT -4. The time now is 08:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.