[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL puzzle

Subject: XSL puzzle
From: "Roshan Sharma" <roshansharma@xxxxxxxxxxx>
Date: Wed, 07 Mar 2001 19:36:59
xa xslt
Pl. help me find why the xsl would not work for the given xml.
Thanks.

---- input.xml -----

<customer name="Test"

	contact-phone="510-555-1212"
	storage-class-id="2"
	contact-person="Tom Hamel"
	contact-email="tom@xxxxxxxx"
	billing-name="Test, Inc."
	id="1_2"
	space="100000000000">
<filesystem fsname="homedirs"

	id="1_100"
	space-quota="1200000000000"/>

<customer name="C1"

	contact-phone="510-555-1212"
	storage-class-id="2"
	contact-person="Mr C1"
	contact-email="C1@xxxxxx"
	billing-name="C1 Inc"
	id="1_3"
	space="4000000000000"/>

<customer name="C2"

	contact-phone="510-555-1212"
	storage-class-id="2"
	contact-person="Mr C2"
	contact-email="blah@xxxxxxxx"
	billing-name="C2 Inc"
	id="1_4"
	space="3000000000000"/>

<customer name="C3"

	contact-phone="510-555-1212"
	storage-class-id="2"
	contact-person="Mr C3"
	contact-email="c3"
	billing-name="C3 Inc"
	id="1_5"
	space="3000000000000"/>

</customer>

---- report.xsl ----
<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform" version="1.0">


<!-- Todo:Set Verbosity level, 5=max (default) -->
<xslt:param name="verbosity" select="'5'" />


<xslt:template match="customer"> <!-- Customer Name --> <xslt:text> Customer Name: </xslt:text> <xslt:value-of select="@name" /> <!-- Contact Phone Number --> <xslt:if test="@contact-number"> <xslt:text>&#xA; Contact Phone No.: </xslt:text> <xslt:value-of select="@contact-number" /> </xslt:if>

  <!-- Storage Class ID -->
  <xslt:if test="@storage-class-id">
     <xslt:text>&#xA; Storage Class ID: </xslt:text>
     <xslt:value-of select="@storage-class-id" />
  </xslt:if>

  <!-- Contact Person Name -->
  <xslt:if test="@contact-person">
     <xslt:text>&#xA; Contact Person Name: </xslt:text>
     <xslt:value-of select="@contact-person" />
  </xslt:if>

  <!-- Contact Person Email -->
  <xslt:if test="@contact-email">
     <xslt:text>&#xA; Contact E-mail: </xslt:text>
     <xslt:value-of select="@contact-email" />
  </xslt:if>

  <!-- Billing Name -->
  <xslt:if test="@billing-name">
     <xslt:text>&#xA; Billing Name: </xslt:text>
     <xslt:value-of select="@billing-name" />
  </xslt:if >

  <!-- Capacity  -->
  <xslt:if test="@space">
    <xslt:text>&#xA; </xslt:text>
    <xslt:text>&#xA; Capacity : </xslt:text>
    <xslt:value-of select="@space div 1000" />
    <xslt:text> KB </xslt:text>
    <xslt:text>&#xA; </xslt:text>
  </xslt:if>

<!-- File Systems for the customer -->

  <!-- More (nested) File systems -->
  <xslt:apply-templates select="/customer/filesystem"/>

  <!-- More (nested) Customers
  <xslt:apply-templates select="/customer"/>
  -->
  <!-- More Customers -->
  <xsl:apply-templates />

<xslt:text>&#xA; </xslt:text>

</xslt:template>

<xslt:template match="filesystem">
     <xslt:text>&#xA;&#x9; File System Name: </xslt:text>
     <xslt:value-of select="@fsname" />
     <xslt:if test="@storage-class-id">
       <xslt:text>&#xA;&#x9; Storage Class ID: </xslt:text>
       <xslt:value-of select="@storage-class-id" />
     </xslt:if>
     <xslt:if test="@space-quota">
       <xslt:text>&#xA;&#x9; Capacity: </xslt:text>
       <xslt:value-of select="@space-quota div 1000" />
       <xslt:text> KB </xslt:text>
       <xslt:text>&#xA; </xslt:text>
     </xslt:if>
</xslt:template>

</xslt:transform>


_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread
  • XSL puzzle
    • Roshan Sharma - Wed, 7 Mar 2001 14:37:56 -0500 (EST) <=
      • <Possible follow-ups>
      • Don Bruey - Wed, 7 Mar 2001 14:54:51 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.