XML to HTML page | Newbie | | Join Date: Nov 2008
Posts: 6
| |
Could someone please help me convert the following XML to HTML page? -
<?xml version="1.0" encoding="UTF-16"?>
-
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
-
<SOAP-ENV:Body>
-
<ns1:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-
<return xsi:type="ns1:GoogleSearchResult">
-
<directoryCategories xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="ns1:DirectoryCategory[2]">
-
<item xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</item>
-
<item xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</item>
-
</directoryCategories>
-
<documentFiltering xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">false</documentFiltering>
-
<endIndex xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:int">10</endIndex>
-
<estimateIsExact xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">false</estimateIsExact>
-
<estimatedTotalResultsCount xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:int">281000</estimatedTotalResultsCount>
-
<resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.mcescher.com/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">2k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">MC <b>Escher</b></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Art, news, history, copyright and MC <b>Escher</b> Foundation information.</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">MC.<b>Escher</b></title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.worldofescher.com/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">28k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">The world of <b>Escher</b></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">The web site to explore the great MC <b>Escher</b> artworks. Each image has<br> commentary and a zoom mode. <b>...</b> The place for everything <b>Escher</b>. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">An online collection of the works of <b>Escher</b>, along with an online store.</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">World of <b>Escher</b> - Secure Shopping, Artwork Gallery, Tesselations <b>...</b></title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.worldofescher.com/gallery/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">48k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">The web site to explore the great MC <b>Escher</b> artworks. Each image has<br> commentary and a zoom mode. <b>...</b> The place for everything <b>Escher</b>. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">World of <b>Escher</b> - Product Gallery</title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.cs.unc.edu/~davemc/Pic/Escher/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">2k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher</b> Art Collection</directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">The <b>Escher</b> Web Page has moved. You should be redirected to the new page<br> in 15 second. If <b>...</b> link: http://home.comcast.net/~davemc0/<b>Escher</b>. </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">A collection of images of artist's works.</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Redirect <b>Escher</b> Web Page</title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.etropolis.com/escher/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">3k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">MC <b>escher</b> about the artist... notes on art... All MC <b>Escher</b> works (c) Cordon Art<br> BV-Baarn-the Netherlands. All rights reserved. Used by permission. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">MC <b>Escher</b></title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.mathacademy.com/pr/minitext/escher/index.asp</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">41k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Mathematical Art of MC <b>Escher</b></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Article on the mathematical art of MC <b>Escher</b>, with emphasis on inspiring<br> the student to see mathematics with fresh eyes. <b>...</b> MC <b>Escher</b>. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">A detailed and liberally illustrated essay on the signifigance of <b>Escher's</b> artwork for the student...</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Mathematical Art of MC <b>Escher</b> -- Platonic Realms MiniText</title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://escherdroste.math.leidenuniv.nl/</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">4k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Leiden University - <b>Escher</b> and the Droste Effect</directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher</b> and the Droste effect. <b>...</b> Applying mathematics to <b>Escher&#39;s</b> Print Gallery. <b>...</b> All<br> MC <b>Escher</b> works © Cordon Art-Baarn-the Netherlands. Used by permission. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Student project aiming to visualize the mathematical structure behind the 'Print Gallery'.</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher</b> and the Droste effect - Universiteit Leiden</title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/Escher.html</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">32k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Maurits Cornelius <b>Escher</b>: A biography</directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Maurits Cornelius <b>Escher</b>. Born: 17 June 1898 in <b>...</b> Maurits <b>Escher</b> was<br> always referred to by his parents as Mauk. He was brought up by <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">A biography of MV <b>Escher</b>.</summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher</b></title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://users.erols.com/ziring/escher.htm</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">14k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">z-logo. Welcome to the MC <b>Escher</b> Pages! MC <b>Escher</b> (1898-1972) is my favorite<br> graphic artist. He lived <b>...</b> entirety. <b>Escher&#39;s</b> Lifetime. Maurits <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Neal&#39;s <b>Escher</b> Page</title>
-
</item>
-
<item xsi:type="ns1:ResultElement">
-
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.lipsons.pwp.blueyonder.co.uk/escher/ascending.html</URL>
-
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">8k</cachedSize>
-
<directoryCategory xsi:type="ns1:DirectoryCategory">
-
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
-
<specialEncoding xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></specialEncoding>
-
</directoryCategory>
-
<directoryTitle xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></directoryTitle>
-
<hostName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></hostName>
-
<relatedInformationPresent xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:boolean">true</relatedInformationPresent>
-
<snippet xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher&#39;s</b> &quot;Ascending and Descending&quot; in LEGO®. Because <b>...</b> effect. The<br> original <b>Escher</b> picture is shown on the right for comparison. <b>...</b> </snippet>
-
<summary xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></summary>
-
<title xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"><b>Escher&#39;s</b> &quot;Ascending and Descending&quot; in LEGO</title>
-
</item>
-
</resultElements>
-
<searchComments xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></searchComments>
-
<searchQuery xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Escher</searchQuery>
-
<searchTime xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:double">0.412154</searchTime>
-
<searchTips xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string"></searchTips>
-
<startIndex xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:int">1</startIndex>
-
</return>
-
</ns1:doGoogleSearchResponse>
-
</SOAP-ENV:Body>
-
</SOAP-ENV:Envelope>
-
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: XML to HTML page
how do you want your html to look like? if you can answer that it should be easy to bend the xml content into html shape.
regards
| | Newbie | | Join Date: Nov 2008
Posts: 6
| | | re: XML to HTML page Quote:
Originally Posted by Dormilich how do you want your html to look like? if you can answer that it should be easy to bend the xml content into html shape.
regards Thanks for your reply. I'm looking for an XLST which will transform the xml to a HTML page that should look like the search results from a google page.
Thanks
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: XML to HTML page
that seems rather easy. your xml targets are (imho) <URL> (link, -> <a>), <snippet> (descr., -> <p>) and <title> (title, -> <h2>). just loop it over <item> and style it appropriately with CSS.
if you're uncertain how to put that into code, I recommend a tutorial.
regards
| | Newbie | | Join Date: Nov 2008
Posts: 6
| | | re: XML to HTML page
thank you. .. since I am very newbie, can you or anyone help me how to go about solving the question. Any input or answer in right direction is highly valued. I am reading the xml book to understand myself but that takes longer time than I wish to arrive at the solution.
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: XML to HTML page
first thing I recommend is a tutorial (see above) to get used to the language.
now for the task. what I'd do is, create the desired html page as if it were static (so you can apply the layout and styles you want without any xslt hassle). then you look for repeating patterns.
have a look at one pattern, how is it build? basicly you need to figure out which part of it will depend on the input xml and which form a kind of template. substitute the variable part with suited 'functions' of xslt, add some headers and finís.
example: - <!DOCTYPE ...>
-
<html>
-
<head>
-
<title>%%PAGE_TITLE%%</title>
-
// meta, css, js definitions
-
</head>
-
<body>
-
<h2>%%HEADING_1%%</h2>
-
<p>%%some_text%%</p>
-
<h2>%%HEADING_2%%</h2>
-
<p>%%some_other_text%%</p>
-
</body>
-
</html>
so you have two patterns, the repeating <h2>/<p> blocks and the html frame (frame in a sense of tag sequence). so template1 will have to produce the frame and template2 will have to be repeatedly called to make the content blocks (where %%text%% is taken from the xml). how to achieve this is covered in nearly every tutorial.
if you stumble upon problems we will be glad helping you to solve the issues.
regards
| | Newbie | | Join Date: Nov 2008
Posts: 6
| | | re: XML to HTML page
I successfully managed to get to a point to make my output HTML Page look decent (if not the best) but got stuck in few places:
1) When I run my XSLT, the hyperlink for my URL does not show up
2) The information in my XML is such that sometimes it has Summary information and sometimes Summary is not present for an item. I need something like an if statement where if summary is ‘null’ don’t print it’s value.
1) Code where I try to use hyperlink for my URL but it does not print so: The output file shows the URL as a plain text and not a hyperlink...
<br><xsl:attribute name="href">
<xsl:value-of select="URL"/>
</xsl:attribute><xsl:value-of select="URL"/></br>
2) I need an if statement here where it will select the value only if it is not empty:
<br>Summary:<xsl:value-of select="summary" disable-output-escaping="yes"/></br>
Could you please guide me on the above two points…
regards,
| | Newbie | | Join Date: Nov 2008
Posts: 6
| | | re: XML to HTML page Quote:
Originally Posted by jollysr I successfully managed to get to a point to make my output HTML Page look decent (if not the best) but got stuck in few places:
1) When I run my XSLT, the hyperlink for my URL does not show up
2) The information in my XML is such that sometimes it has Summary information and sometimes Summary is not present for an item. I need something like an if statement where if summary is ‘null’ don’t print it’s value.
1) Code where I try to use hyperlink for my URL but it does not print so: The output file shows the URL as a plain text and not a hyperlink...
<br><xsl:attribute name="href">
<xsl:value-of select="URL"/>
</xsl:attribute><xsl:value-of select="URL"/></br>
2) I need an if statement here where it will select the value only if it is not empty:
<br>Summary:<xsl:value-of select="summary" disable-output-escaping="yes"/></br>
Could you please guide me on the above two points…
regards, I figured out an answer for 1) - it should be <a> and not <br> !!!!!!!!!!!!!!!!!!!!
Could someone help me with 2) ?
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: XML to HTML page
if a element/value is empty its output by <xsl:value-of> is '' (empty string).
if you want to make a fallback (or something like that), use <xsl:if> or <xsl:choose> - <xsl:choose>
-
<xsl:when test="summary">
-
<xsl:value-of select="summary"/>
-
// add more text if needed
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:text>Sorry, no summary found</xsl:text>
-
</xsl:otherwise>
-
</xsl:choose>
| | Newbie | | Join Date: Nov 2008
Posts: 6
| | | re: XML to HTML page
Thanks a lot! That helped.
I'm stuck in another place and would really appreciate if some input is given.
This is my issue:
I need to group the result items according to the directory categories. Directory category name should precede the items that belong to that category.
Directory category:
<directoryCategories xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="ns1:DirectoryCategory[2]">
<item xsi:type="ns1:DirectoryCategory"> <fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
<item xsi:type="ns1:DirectoryCategory"> <fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Shopping/Visual_Arts/Artists</fullViewableName>
The result item has fullViewableName, this needs to be grouped under the corresponding value it matches above.
<resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">
<item xsi:type="ns1:ResultElement">
<URL xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">http://www.mcescher.com/</URL>
<cachedSize xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">2k</cachedSize>
<directoryCategory xsi:type="ns1:DirectoryCategory">
<fullViewableName xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">Top/Arts/Art_History/Artists/E/Escher,_M._C.</fullViewableName>
Thanks,
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: XML to HTML page
for sorting you can use the <xsl:sort> instruction.
please pleas wrap your code in [code] tags, it's nearly unreadable now (esp. with all that more or less unnecessary namescpace definitions).
you may consider loop over category first and then over all items contained therein.
regards
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|