473,466 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

xslt & navigation url

7 New Member
here is my xml code:
filename: cdcollection.xml

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!-- Edited by XMLSpy® -->
  3.  
  4. <catalog>
  5.    <cd>
  6.     <title>Empire Burlesque</title>
  7.     <artist>Bob Dylan</artist>
  8.     <country>USA</country>
  9.     <company>Columbia</company>
  10.     <price>10.90</price>
  11.     <year>1985</year>
  12.   </cd>
  13.   <cd>
  14.     <title>Hide your heart</title>
  15.     <artist>Bonnie Tyler</artist>
  16.     <country>UK</country>
  17.     <company>CBS Records</company>
  18.     <price>9.90</price>
  19.     <year>1988</year>
  20.   </cd>
  21.   <cd>
  22.     <title>Greatest Hits</title>
  23.     <artist>Dolly Parton</artist>
  24.     <country>USA</country>
  25.     <company>RCA</company>
  26.     <price>9.90</price>
  27.     <year>1982</year>
  28.   </cd>
  29.   <cd>
  30.     <title>Still got the blues</title>
  31.     <artist>Gary Moore</artist>
  32.     <country>UK</country>
  33.     <company>Virgin records</company>
  34.     <price>10.20</price>
  35.     <year>1990</year>
  36.   </cd>
  37.   <cd>
  38.     <title>Eros</title>
  39.     <artist>Eros Ramazzotti</artist>
  40.     <country>EU</country>
  41.     <company>BMG</company>
  42.     <price>9.90</price>
  43.     <year>1997</year>
  44.   </cd>
  45.   <cd>
  46.     <title>One night only</title>
  47.     <artist>Bee Gees</artist>
  48.     <country>UK</country>
  49.     <company>Polydor</company>
  50.     <price>10.90</price>
  51.     <year>1998</year>
  52.   </cd>
  53.   <cd>
  54.     <title>Sylvias Mother</title>
  55.     <artist>Dr.Hook</artist>
  56.     <country>UK</country>
  57.     <company>CBS</company>
  58.     <price>8.10</price>
  59.     <year>1973</year>
  60.   </cd>
  61.   <cd>
  62.     <title>Maggie May</title>
  63.     <artist>Rod Stewart</artist>
  64.     <country>UK</country>
  65.     <company>Pickwick</company>
  66.     <price>8.50</price>
  67.     <year>1990</year>
  68.   </cd>
  69.   <cd>
  70.     <title>Romanza</title>
  71.     <artist>Andrea Bocelli</artist>
  72.     <country>EU</country>
  73.     <company>Polydor</company>
  74.     <price>10.80</price>
  75.     <year>1996</year>
  76.   </cd>
  77.   <cd>
  78.     <title>When a man loves a woman</title>
  79.     <artist>Percy Sledge</artist>
  80.     <country>USA</country>
  81.     <company>Atlantic</company>
  82.     <price>8.70</price>
  83.     <year>1987</year>
  84.   </cd>
  85.   <cd>
  86.     <title>Black angel</title>
  87.     <artist>Savage Rose</artist>
  88.     <country>EU</country>
  89.     <company>Mega</company>
  90.     <price>10.90</price>
  91.     <year>1995</year>
  92.   </cd>
  93.   <cd>
  94.     <title>1999 Grammy Nominees</title>
  95.     <artist>Many</artist>
  96.     <country>USA</country>
  97.     <company>Grammy</company>
  98.     <price>10.20</price>
  99.     <year>1999</year>
  100.   </cd>
  101.   <cd>
  102.     <title>For the good times</title>
  103.     <artist>Kenny Rogers</artist>
  104.     <country>UK</country>
  105.     <company>Mucik Master</company>
  106.     <price>8.70</price>
  107.     <year>1995</year>
  108.   </cd>
  109.   <cd>
  110.     <title>Big Willie style</title>
  111.     <artist>Will Smith</artist>
  112.     <country>USA</country>
  113.     <company>Columbia</company>
  114.     <price>9.90</price>
  115.     <year>1997</year>
  116.   </cd>
  117.   <cd>
  118.     <title>Tupelo Honey</title>
  119.     <artist>Van Morrison</artist>
  120.     <country>UK</country>
  121.     <company>Polydor</company>
  122.     <price>8.20</price>
  123.     <year>1971</year>
  124.   </cd>
  125.   <cd>
  126.     <title>Soulsville</title>
  127.     <artist>Jorn Hoel</artist>
  128.     <country>Norway</country>
  129.     <company>WEA</company>
  130.     <price>7.90</price>
  131.     <year>1996</year>
  132.   </cd>
  133.   <cd>
  134.     <title>The very best of</title>
  135.     <artist>Cat Stevens</artist>
  136.     <country>UK</country>
  137.     <company>Island</company>
  138.     <price>8.90</price>
  139.     <year>1990</year>
  140.   </cd>
  141.   <cd>
  142.     <title>Stop</title>
  143.     <artist>Sam Brown</artist>
  144.     <country>UK</country>
  145.     <company>A and M</company>
  146.     <price>8.90</price>
  147.     <year>1988</year>
  148.   </cd>
  149.   <cd>
  150.     <title>Bridge of Spies</title>
  151.     <artist>T`Pau</artist>
  152.     <country>UK</country>
  153.     <company>Siren</company>
  154.     <price>7.90</price>
  155.     <year>1987</year>
  156.   </cd>
  157.   <cd>
  158.     <title>Private Dancer</title>
  159.     <artist>Tina Turner</artist>
  160.     <country>UK</country>
  161.     <company>Capitol</company>
  162.     <price>8.90</price>
  163.     <year>1983</year>
  164.   </cd>
  165.   <cd>
  166.     <title>Midt om natten</title>
  167.     <artist>Kim Larsen</artist>
  168.     <country>EU</country>
  169.     <company>Medley</company>
  170.     <price>7.80</price>
  171.     <year>1983</year>
  172.   </cd>
  173.   <cd>
  174.     <title>Pavarotti Gala Concert</title>
  175.     <artist>Luciano Pavarotti</artist>
  176.     <country>UK</country>
  177.     <company>DECCA</company>
  178.     <price>9.90</price>
  179.     <year>1991</year>
  180.   </cd>
  181.   <cd>
  182.     <title>The dock of the bay</title>
  183.     <artist>Otis Redding</artist>
  184.     <country>USA</country>
  185.     <company>Atlantic</company>
  186.     <price>7.90</price>
  187.     <year>1987</year>
  188.   </cd>
  189.   <cd>
  190.     <title>Picture book</title>
  191.     <artist>Simply Red</artist>
  192.     <country>EU</country>
  193.     <company>Elektra</company>
  194.     <price>7.20</price>
  195.     <year>1985</year>
  196.   </cd>
  197.   <cd>
  198.     <title>Red</title>
  199.     <artist>The Communards</artist>
  200.     <country>UK</country>
  201.     <company>London</company>
  202.     <price>7.80</price>
  203.     <year>1987</year>
  204.   </cd>
  205.   <cd>
  206.     <title>Unchain my heart</title>
  207.     <artist>Joe Cocker</artist>
  208.     <country>USA</country>
  209.     <company>EMI</company>
  210.     <price>8.20</price>
  211.     <year>1987</year>
  212.   </cd>
  213. </catalog>
  214.  
here is my xsl code
filename : cd.xslt

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
  4. >
  5.     <xsl:output method="html" indent="yes"/>
  6.  
  7.     <xsl:template match="/">
  8.  
  9.       <h2>My CD Collection</h2>
  10.       <table border="1">
  11.         <tr bgcolor="#9acd32">
  12.           <th>Title</th>
  13.           <th>Artist</th>
  14.         </tr>
  15.         <xsl:for-each select="catalog/cd">
  16.           <tr>
  17.             <td>
  18.               <xsl:value-of select="title"/>
  19.             </td>
  20.             <td>
  21.               <xsl:value-of select="artist"/>
  22.             </td>
  23.           </tr>
  24.         </xsl:for-each>
  25.       </table>
  26.  
  27.     </xsl:template>
  28. </xsl:stylesheet>
  29.  
filename : tranform.aspx.cs

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Xml;
  12. using System.Xml.Xsl;
  13. using System.Xml.XPath;
  14.  
  15. public partial class _Default : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         string xmlPath = Server.MapPath("cdcollection.xml");
  20.          string xslPath = Server.MapPath("cd.xslt"); 
  21.  
  22.          //Instantiate the XPathDocument Class
  23.          XPathDocument doc = new XPathDocument(xmlPath);
  24.  
  25.          //Instantiate the XslTransform Class
  26.          XslCompiledTransform transform = new XslCompiledTransform();
  27.          transform.Load(xslPath);
  28.  
  29.          //Custom format the indenting of the output document
  30.          //by using an XmlTextWriter
  31.          XmlTextWriter writer = new XmlTextWriter(Response.Output);
  32.          writer.Formatting = Formatting.Indented;
  33.          writer.Indentation=4;
  34.          transform.Transform(doc, null, writer);
  35.  
  36.     }
  37. }
  38.  
  39.  
My task is that if I click on home page , the xml data (cdcollection.xml) is displayed according to cd.xslt at home page.
how could it be posiible ? plz help its urgent
Attached Files
File Type: zip testxslt.zip (14.2 KB, 61 views)
Jun 15 '10 #1
0 906

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: petermichaux | last post by:
Hi, I've searched the usenet groups and used google to look for good, active forums for XHTML, XML, XSLT and CSS but I cannot find any. Since PHP is related to the web, I thought I'd ask here...
3
by: rufio | last post by:
Hi all I have a <xsl:template> that matches an <element>, but i found that this template doesn't match <element xmlns="URL">. Why and how to match it? Regards, Rufio
4
by: A Amitkashaw | last post by:
Hi Everyone. I'm having a few problems with the following XSL statement - <xsl:template match="htm:div"> <xsl:for-each select="../following-sibling::*/child::htm:i"> <xsl:value-of...
0
by: JEDI_BC | last post by:
hi, I try hardly to use javascript functions in my XSL (exslt.org) using DOM/XSL (libxslt). It works on sablotron but it is too slow and cost too much cpu. I am up to date on my software...
0
by: JohnSmith | last post by:
Hi, I'm consuming a webservice which returns an XMLNode with VB.NET and XSLT and sending the output to Response.OutputStream If I feed the returned XMLNode directly in the transform method, I...
5
by: Prakash | last post by:
I have a continuous form in which I don't want to allow more than 255 rows. There is a field called sub_tran_no which is of the type "BYTE" & hence the restriction. My Problem: -----------...
1
by: WStoreyII | last post by:
Two question, 1) is there a way to edit the interface of the display for when accessing a asmx file through the browser as opposed to that default web service interface. For example what if i...
4
by: gouranga | last post by:
Sablotron keeps giving an error (non-XSL instruction) on the line with this code: <xsl:result-document href="slideshow/index.html" format="html"> Is this implemented in Sablotron? It's quite...
10
by: Bilal | last post by:
Hello, I'm trying to perform some string manipulations in my stylesheet and have gotten stuck on the issue below so hopefully can elicit some useful hints. Namely, the problem is that I need to...
4
by: JustinCarmony | last post by:
My employer wants me to explore the possibilities of XSLT for a new project I am working on. It seems to work great for some things, but here is an issue: My boss wants to make a XML based web...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.