DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: XSL output not correct

  1. #1
    Join Date
    Sep 2007
    Posts
    2

    XSL output not correct

    test.xsl:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet  
    	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    	xmlns:ns0="http://www.sophis.net/Instrument"
    	xmlns:ns1="http://www.sophis.net/otc_message"
      xmlns:ns2="http://www.sophis.net/common" version="1.0">
      <xsl:output method="xml"/>
    <xsl:template match="/">
    {
    Allotment: <xsl:value-of select="//ns0:allotment"/><xsl:value-of select="//ns2:allotment"/>
    -}
    </xsl:template>
    </xsl:stylesheet>
    When I use above xsl to convert to xml I get exact output as what has been mentioned in xsl file? Any idea please?

    2nd query:
    test1.txt
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet  
    	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    	xmlns:ns0="http://www.sophis.net/Instrument"
    	xmlns:ns1="http://www.sophis.net/otc_message"
      xmlns:ns2="http://www.sophis.net/common" version="1.0">
    
    <xsl:output method="xml" media-type="XML:text/xml"/>
    
    <xsl:template match="/">
    {
    Allotment: <xsl:value-of select="//ns0:allotment"/><xsl:value-of select="//ns2:allotment"/>
    -}
    
    </xsl:template>
    </xsl:stylesheet>
    When i use this file to convert to xml i get output as:

    <?xml version="1.0" encoding="UTF-8"?>
    {
    Allotment: Share
    -}

    Why i am seeing the <?xml version="1.0" encoding="UTF-8"?> this line in output.

    So 2 questions if anybody can help please?

  2. #2
    Join Date
    May 2009
    Posts
    60
    you use
    Code:
    <xsl:output method="xml" media-type="XML:text/xml"/>
    then will create
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    Code:
    <xsl:output indent="yes" method="xml" media-type="XML:text/xml" 
    omit-xml-declaration="yes" />
    then will create

    Code:
    {
    Allotment: Share
    -}

Similar Threads

  1. Problem displaying desired output via XSL
    By sleepy.head in forum XML
    Replies: 0
    Last Post: 02-24-2011, 08:54 PM
  2. XSL Help - Displaying Output In A Table
    By h4x0rz3d in forum XML
    Replies: 0
    Last Post: 11-03-2006, 06:50 AM
  3. Replies: 2
    Last Post: 08-22-2001, 03:31 PM
  4. Replies: 2
    Last Post: 08-31-2000, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center