AllExperts > Experts 
Search      

XML

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More XML Answers
Question Library

Ask a question about XML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ashvin
Expertise
I can handle all the queries related to XML. I can sort out problems regarding XSLT and XSL. I work using MSXML components. I can handle XML-SQl, XML-VB and XMl-ASP related queries.

Experience
I have worked for 2years in this feild. I have worked in SGML and DTDs, and now working in XML and Schemas.

 
   

You are here:  Experts > Computing/Technology > HTML/XML > XML > a sample stylesheet

Topic: XML



Expert: Ashvin
Date: 5/22/2004
Subject: a sample stylesheet

Question
Hello expert
I have simple xml file and i need a stylrsheet to transform it.
my xml file is

<doc_name>
<title>
  something
</title>
<documentId>
  somethinge else
</documentId>
</doc_name>

but i want to pass the doc_name as a parameter
to xslt file.
can you help me?

TNNNNNNNNNNNNNNNNNNX


Answer
Hello Mahdi,
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="*">
     <html>
        <head>
           <title>Ashvin Johnson</title>
        </head>
        <body>ashvinJohnson</body>
     </html>
     <xsl:choose>
        <xsl:when test="//doc_name">
           <xsl:call-template name="docTemplate"/>
        </xsl:when>
     </xsl:choose>
  </xsl:template>
  
  <xsl:template name="docTemplate">
     <h2><xsl:value-of select="title" /></h2>
  </xsl:template>
</xsl:stylesheet>


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.