[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

How to keep displaying constant spacing between the values of an xml file when used xsl file to display in text format?

Asked by vihar123 in Extensible Markup Language (XML)

Tags: sharath, xsl, defaultemail

i have an xml file

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl"?>
<Order OrderNo="582" Orderdate="7/16/2003 3:34:42 PM" Shipdate="7/18/2003 3:34:42 PM">
  <Products TotalCost="$20.00">
    <Product ProductId="438" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-0035-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="213" ProdName="Men-T-Shirt" ModelName="MO-0035-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="123" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-0011-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="567" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-0011-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="458" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-0011-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="428" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-0011-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="456" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-00s-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
    <Product ProductId="449" ProdName="Men-T-Shirt, Yacht, weiß, L" ModelName="MO-00sa-MTSYA-W-L" Quantity="1" UnitCost="20.00" SubTotal="20.00" />
  </Products>
  <ShippingAddress Firstname="Sharath" Lastname="Neela" Street="Hubertus Str 5" ZipCode="83022" Location="Rosenheim" Country="Deutschland" />
</Order>


my xsl is:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method = "text" encoding = "ISO-8859-1" omit-xml-declaration = "yes"/>

      <xsl:template match="/">
            <xsl:call-template name="DefaultEmail"/>
      </xsl:template>

      <xsl:template name="DefaultEmail">
            <xsl:call-template name="OrderDetails"/><xsl:call-template name="ShippingAddress"/><xsl:text>&#10;</xsl:text><xsl:text>&#10;</xsl:text>
      </xsl:template>


      <xsl:template name="OrderDetails">Your Order No:<xsl:value-of select="Order/@OrderNo"/>,  Dated on <xsl:value-of select="Order/@Orderdate"/>
            <xsl:text>&#10;</xsl:text><xsl:text>&#10;</xsl:text>
      </xsl:template>


<xsl:template name="ProductDetails">

<xsl:text>&#10;</xsl:text><xsl:text>&#10;</xsl:text>
SerialNo&#9;ProductID&#9;ProductName&#9;&#9;&#9;&#9;Model&#9;&#9;Quantity&#9;Price&#9;Subtotal
--------&#9;---------&#9;-----------&#9;&#9;&#9;&#9;-----&#9;&#9;--------&#9;-----&#9;--------
<xsl:for-each select="Order/Products/Product">
<xsl:value-of select="position()"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@ProductId"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@ProdName"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@ModelName"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@Quantity"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@UnitCost"/>
<xsl:text>&#9;&#9;</xsl:text>
<xsl:value-of select="@SubTotal"/>
<xsl:text>&#9;&#9;</xsl:text><xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:text>Total : </xsl:text><xsl:value-of select="//Products/@TotalCost"/>
<xsl:text>&#10;</xsl:text>

</xsl:template>


</xsl:stylesheet>


This produces the below output:

Your Order No:582,  Dated on 7/16/2003 3:34:42 PM

Serial No  ProductID       Product Name                    Model           Quantity      Price      Subtotal      
   1            438    Men-T-Shirt, Yacht, weiß, L   MO-0035-MTSYA-W-L   1      20.00        20.00
   2            213    Men-T-Shirt, Yacht, weiß, L   MO-0035-MTSYA-W-L   1      20.00        20.00
   3            123    Men-T-Shirt   MO-0011-MTSYA-W-L   1      20.00        20.00
   4            567    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   5            458    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   6            428    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   7            456    Men-T-Shirt, Yacht, weiß, L   MO-00s-MTSYA-W-L   1      20.00        20.00
   8            449    Men-T-Shirt, Yacht, weiß, L   MO-00sa-MTSYA-W-L   1      20.00        20.00


the number of characters(string length) for the values of productname is different.
as the number characters are different,the alignment is changing.


how to keep a constant spacing for each productname.

for example for one productname the characters are 27,
for other productname characters are 10.for this product i want to fill remaining 17 characters with spaces .

so that the format is correct.

I AM TRYING TO GET THE BELOW FORMAT:

 

Serial No  ProductID       Product Name                    Model           Quantity      Price      Subtotal      
   1            438    Men-T-Shirt, Yacht, weiß, L   MO-0035-MTSYA-W-L   1      20.00        20.00
   2            213    Men-T-Shirt, Yacht, weiß, L   MO-0035-MTSYA-W-L   1      20.00        20.00
   3            123    Men-T-Shirt,W               MO-0011-MTSYA-W-L   1      20.00        20.00
   4            567    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   5            458    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   6            428    Men-T-Shirt, Yacht, weiß, L   MO-0011-MTSYA-W-L   1      20.00        20.00
   7            456    Men-T-Shirt, Yacht, weiß, L   MO-00s-MTSYA-W-L    1      20.00        20.00
   8            449    Men-T-Shirt, Yacht, weiß, L   MO-00sa-MTSYA-W-L   1      20.00        20.00



Hope you understood the question.




Thanks for any kind of help
vihar123
 
Related Solutions
Keywords: How to keep displaying constant spaci…
Title
1 img
 
Loading Advertisement...
 
[+][-]07/17/03 08:13 AM, ID: 8943390Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/17/03 08:13 AM, ID: 8943393Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/17/03 10:46 AM, ID: 8944828Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/18/03 03:03 AM, ID: 8950441Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/18/03 07:41 AM, ID: 8952221Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Extensible Markup Language (XML)
Tags: sharath, xsl, defaultemail
Sign Up Now!
Solution Provided By: ChuckSmith_Supernus
Participating Experts: 1
Solution Grade: A
 
[+][-]07/21/03 02:34 AM, ID: 8966009Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89