XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
benjamin yapSubject: XSL problem
Author: benjamin yap
Date: 05 Mar 2006 09:10 PM
hi all,

I am new to xsl.Recently i had a problem converting xml to html.Here is the table that i wish to appear in html:

name sex code job
steven male 1 accountant
richard male 2 engineer
daniel male 3 scientist


But i just cant convert to html as what i wanted.xml code as below:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="inter2.xsl"?>
<saved>
<mo>
<attribute name="job">accountant</attribute>
<attribute name="sex">male</attribute>
<attribute name="code">1</attribute>
<attribute name="name">steven</attribute>
</mo>
<mo>
<attribute name="job">engineer</attribute>
<attribute name="sex">male</attribute>
<attribute name="code">2</attribute>
<attribute name="name">richard</attribute>
</mo>
<mo>
<attribute name="job">scientist</attribute>
<attribute name="sex">male</attribute>
<attribute name="code">3</attribute>
<attribute name="name">daniel</attribute>
</mo>
</saved>

This is my xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v4.2 -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="saved">
<html>
<body>
<h2>FIRST TRIAL</h2>
<table border="2">
<tr bgcolor="#black">
<th align="center">job</th>
<th align="center">sex</th>
<th align="center">code</th>
<th align="center">name</th>
</tr>
<xsl:for-each select="mo/attribute">
<tr>
<td><xsl:value-of select="."/></td>
<td><xsl:value-of select="."/></td>
<td><xsl:value-of select="."/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Can any one help to point out my error on the xsl code?Thousand thanks

Postnext
Minollo I.Subject: XSL problem
Author: Minollo I.
Date: 06 Mar 2006 08:57 AM
You can try something like the following; BTW, this is the Stylus Studio technical support forum; if you are an XML Spy user (as the comment in your XSLT suggests), you may either consider asking for help to their support organization, or switch to Stylus Studio altogether.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with Stylus Studio 2006 Enterprise Edition -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="saved">
<html>
<body>
<h2>FIRST TRIAL</h2>
<table border="2">
<tr bgcolor="#black">
<th align="center">job</th>
<th align="center">sex</th>
<th align="center">code</th>
<th align="center">name</th>
</tr>
<xsl:for-each select="/saved/mo">
<tr>
<td>
<xsl:value-of select="attribute[@name='job']"/>
</td>
<td>
<xsl:value-of select="attribute[@name='sex']"/>
</td>
<td>
<xsl:value-of select="attribute[@name='code']"/>
</td>
<td>
<xsl:value-of select="attribute[@name='name']"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Posttop
benjamin yapSubject: XSL problem
Author: benjamin yap
Date: 06 Mar 2006 09:16 AM
dearest stylus team,

Thanks for your greatest help. I was not aware of this as somebody gave me the xml script and asked me to convert to html . I am not aware of the spy user nor stylus editor previously as i am new to xml world. But with ur greatest help/support, i will feedback to my boss to consider switch to sytlus editor in the coming purchase. Thanks alot!!

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.