Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  Spam!  
Old August 13th, 2014, 05:17 PM
Registered User
 
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>





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 07:32 AM
transform a xml to a html table robert_trudel_fr XSLT 3 December 3rd, 2006 02:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.