Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my xml is as below
HTML
<root>
    <Keyword_Details>
        <link>www.google.com</link>
        <casename>EX PARTE JIM </casename>
        <docket>No. 114.</docket>
        <date>January 22, 2016.</date>
    </Keyword_Details>
    <Keyword_Details>
        <link>www.test.com</link>
        <casename>EX PARTE LOWE</casename>
        <docket>No. 2140.</docket>
        <date>January 22, 2016.</date>
    </Keyword_Details>
</root>


I want the result as below which are hyperlinks linked to the urls between link tags in this case it is www.google.com

EX PARTE JIM (Date Submitted: January 22, 2016.)
docket No. 114.


I want the result as below which are hyperlinks linked to the urls between link tags in this case it is www.test.com

EX PARTE LOWE (Date Submitted: January 22, 2016.)
docket No. 2140.


I want the result as hyperlinks, when clicked on result it should redirect to the page(url) given between <link>tags.
I hope am clear now.
Am a fresher

Thanks in advance
Posted
Updated 26-Jan-16 20:07pm
v3
Comments
BillWoodruff 27-Jan-16 3:11am    
What have you tried so far ? Show your code ?

1 solution

Here is XML data:
XML
<root>
    <keyword_details>
        <link>www.google.com</link>
        <casename>EX PARTE JIM </casename>
        <docket>No. 114.</docket>
        <date>January 22, 2016.</date>
    </keyword_details>
    <keyword_details>
        <link>www.test.com</link>
        <casename>EX PARTE LOWE</casename>
        <docket>No. 2140.</docket>
        <date>January 22, 2016.</date>
    </keyword_details>
</root>

Nest is to design a xslt file using below code:
XML
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">  
   <body style="font-family:Arial;font-size:12pt;">   
      <xsl:for-each select="root/keyword_details"> 
			<span> 
				<span>
				<a href="http://{link}" target="_blank"><xsl:value-of select="link"/></a>
				</span>  
				<br/>
				
				 <span>			
					<span style="font-weight:bold">  
					  <xsl:value-of select="casename" /> 					 
					(Date Submitted: <xsl:value-of select="date" />)
				   </span> 
				 </span>  
				 <div style="font-weight:bold">  
					 Docket <xsl:value-of select="docket" />  
				 </div>
			</span>
			<br/>
		</xsl:for-each>
   </body>  
</html>

Once you designed xslt, follow below link to implement to display data:

Rendering XML Data as HTML using XSL Transformation and ASP.NET XML Control[^]
 
Share this answer
 
v3
Comments
Mydsh 27-Jan-16 1:55am    
Thank You, but how do I link the url which are between link tags.
in the above xml we have <link> www.google.com </link>, that is casename and date as hyperlinks
[no name] 27-Jan-16 1:58am    
You didn't mention in your question. Secondly click widget "Improve Question" and tell what output do you exactly need.
Mydsh 27-Jan-16 2:31am    
Great!!! Thanks a lot
BillWoodruff 27-Jan-16 3:10am    
Why are you writing code for the user, instead of helping the user to learn to write code for themselves ?

Posts that start with "I want/need/require," and show no code, no indication of effort, are most likely homework, or someone with a job they are not qualified for, or someone who just doesn't want to make any effort to solve the problem for themselves.
[no name] 27-Jan-16 3:21am    
okay. Thanks for comment. Secondly I just provided only code for xslt and provided the link to display data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900