Need XSL help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Need XSL help

  1. #1
    Join Date
    Sep 2010
    Posts
    4

    Need XSL help

    i know their is problem in my XSL file can anyone correct my mistake please i really fed up.
    Here is my xml file

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <CategorySearch format="Tree" id="601" xmlns="urn:yahoo:prods">
        <Category catalogs="false" id="601" name="Home Page" refinements="false">
            <Category catalogs="false" id="100334923" name="Baby &amp; Nursery" refinements="false">
                <Category catalogs="false" id="100450223" name="Baby Travel &amp; Carriers" refinements="false">
                    <Category catalogs="false" id="100466023" name="Baby Bouncers, Swings &amp; Walkers" refinements="true"/>
                    <Category catalogs="false" id="100450423" name="Baby Car Seats" refinements="true"/>
                    <Category catalogs="false" id="100450623" name="Baby Carriers" refinements="true"/>
                    <Category catalogs="false" id="100450523" name="Baby Travel Cots" refinements="true"/>
                    <Category catalogs="false" id="100450723" name="Pushchair Accessories" refinements="true"/>
    
                    <Category catalogs="false" id="100450323" name="Pushchairs &amp; Strollers" refinements="true"/>
                </Category>
        </Category>
    </CategorySearch>
    here is my xsl code

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
        xmlns:user="urn:comparionsplus-com:xslt"
        xmlns:herbew="urn:herbew:prods">
        <xsl:output method="html"/>
        <xsl:template match="/">
            <html>
                <body>
                    <xsl:apply-templates select="herbew:CategorySearch/herbew:Category"/>
                </body>
            </html>
        </xsl:template>
    	<xsl:template match="herbew:Category/herbew:Category/herbew:Category">
    	<xsl:value-of select="herbew:Category" />
    	</xsl:template>
    </xsl:stylesheet>
    any help will appreciable

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    You didn't specify the problem. What is happening? Are you getting an error?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    May 2009
    Location
    United Kingdom
    Posts
    49
    My guess is that your namespace declaration is incorrect.

    Your declared namespace in the XSL is:
    Code:
    xmlns:herbew="urn:herbew:prods"
    Where as your XML is in the namespace:
    Code:
    xmlns="urn:yahoo:prods"
    Last edited by reedy837; 10-05-2010 at 03:33 AM.

  4. #4
    Join Date
    Oct 2008
    Posts
    142
    hi there,

    it should be:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <CategorySearch format="Tree" id="601" xmlns="urn:yahoo:prods">
    	<Category catalogs="false" id="601" name="Home Page" refinements="false">
    		<Category catalogs="false" id="100334923" name="Baby &amp; Nursery" refinements="false">
    			<Category catalogs="false" id="100450223" name="Baby Travel &amp; Carriers" refinements="false">
    				<Category catalogs="false" id="100466023" name="Baby Bouncers, Swings &amp; Walkers" refinements="true"/>
    				<Category catalogs="false" id="100450423" name="Baby Car Seats" refinements="true"/>
    				<Category catalogs="false" id="100450623" name="Baby Carriers" refinements="true"/>
    				<Category catalogs="false" id="100450523" name="Baby Travel Cots" refinements="true"/>
    				<Category catalogs="false" id="100450723" name="Pushchair Accessories" refinements="true"/>
    
    				<Category catalogs="false" id="100450323" name="Pushchairs &amp; Strollers" refinements="true"/>
    			</Category>
    		</Category>
    	</Category>	
    </CategorySearch>
    you were missing a category closing tag.
    still, you are right because your xsl transformation is not giving any output after i corrected your xml file, and also after correcting "urn:herbewrods" with "urn:yahoorods", in your xsl file, which of course looks logical. i also found out your xsl file doesn't report errors after your apply its transformation.

    best regards,

    tonci korsano

Similar Threads

  1. Replies: 1
    Last Post: 11-23-2002, 02:40 AM
  2. XML and XSL transforming
    By grothlander in forum XML
    Replies: 0
    Last Post: 12-03-2001, 11:06 AM
  3. Nesting XSL For-Each Statements
    By JamesE in forum XML
    Replies: 2
    Last Post: 05-03-2001, 05:37 AM
  4. Replies: 0
    Last Post: 03-20-2001, 02:11 PM
  5. Replies: 2
    Last Post: 03-20-2001, 02:08 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