Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > Forum and Wrox.com Feedback
|
Forum and Wrox.com Feedback Post your suggestions for improving the Forums or Wrox.com or questions for the staff here. "Where can I find the code for my book?"
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Forum and Wrox.com Feedback 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
  #1 (permalink)  
Old August 13th, 2014, 05:25 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 have an xlst that returns multiple results. I want to add headers at the top of the xml so it has something like: Display label Ci Type Environment Phbrsp-s3297 Node Production Phbrsp-s3235 node Production

at the moment the xlst is displaying the header for each returned result but i dont want it to be like that. I tested with the header for display name thats when it was displaying on the new line for each result. that is my current xslt:
the xlst query
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 the xml

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>
  #2 (permalink)  
Old April 9th, 2015, 06:32 AM
Registered User
 
Join Date: Apr 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have an xlst that returns multiple results. I want to add headers at the top of the xml so it has something like: Display label Ci Type Environment Phbrsp-s3297 Node Production Phbrsp-s3235 node Production





Similar Threads
Thread Thread Starter Forum Replies Last Post
XLST transform xml multiple query and display results in html table tatetiffany XSLT 0 August 13th, 2014 05:17 PM
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.