Subject:Need help to convert XMl -> HTML Author:Praneeth PV Date:21 Apr 2007 08:53 AM
Hi there,
Am new to xsl. I am trying to convert an xml to html. The structure of my xml looks like this.
<lines>
<line>
<A>+</A>
<B>BLUE</B>
<C>DATA1</C>
</line>
<line>
<A>+</A>
<B>PINK</B>
<C>DATA2</C>
</line>
</lines>
I want my html output to look like this:
+DATA1
+DATA2
The color mentioned in <B> indicates the bgcolor, it is valid till the next <B> is encountered.
As mentioned earlier, am very new to xsl. I guess my XPATH expressions are not correct. My output looks like this:
+
DATA1
+
DATA2
I want all <line> elements to end with a newline, and all children in a line element should be on the same line.
Subject:Need help to convert XMl -> HTML Author:(Deleted User) Date:23 Apr 2007 12:54 PM
Hi Praneeth,
you need to give us more informations:
- which version of Stylus Studio are you using?
- which XSLT processor are you using?
- is the XSLT generating TEXT or HTML?
- could you post the fragment of the XSLT that generates the result you posted?
This is the xsl I have written:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<head><title>MyHTML</title></head>
<body>
<pre>
<xsl:for-each select="lines">
<xsl:for-each select="child::line">
Subject:Need help to convert XMl -> HTML Author:(Deleted User) Date:24 Apr 2007 09:26 AM
Hi Praneeth,
even if you didn't define a template for B, XSLT defines a default template that prints any text node (including the text nodes that makes up the indentation of the XSLT stylesheet itself).
I would suggest you to download a trial copy of Stylus Studio and use its debugger to see how a processor generates its output.