XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 14th, 2004, 11:20 AM
zguille zguille is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 zguille User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to zguille
how can I put html tags into xsl? help please!

Hi, I want to create an html file using an xslt document and xml data. I'm a xsl/xml begginer, so I'm sorry if there is something stupid.
I'm trying to group some divs into one table and the way I found to do it in the xslt is the following:
...
<table><tr><td>
<xsl:for-each...>
<div>...</div><div>...</div>.....
<xsl:if....> <!--every 8 divs, close and open other table-->
</td></tr></table><table><tr><td>
</xsl:if>
</xsl:for-each>
</td></tr></table>
....

But what I get in the html file is < and > instead of < and >.
Of course I did't put inside the if element exactly what you see here (it brings an error), it's only what I want to appears in the html file. I have tried with several things, i.e CDATA, xsl:text, etc. But I obtain always the same result.

How can I do this please?

Thanx a lot in advance.

Reply With Quote
  #2  
Old June 14th, 2004, 05:13 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,569 jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 22 h 42 m 51 sec
Reputation Power: 835
Here's one of mine:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
    method="html"
    version="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    encoding="ISO-8859-1"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    indent="yes"
    media-type="text/html" />
<xsl:template match="/collection">
<html>
<head>
<title>MTG Card Collection</title>
</head>
<body>
<xsl:value-of select="sum(card/@quantity)" /> :: <xsl:value-of select="sum(card/@price)" />
<xsl:for-each select="card">
<xsl:sort select="@edition" />
<p><xsl:value-of select="@quantity" /><xsl:text> </xsl:text><xsl:value-of select="@name" /> from <xsl:value-of select="@edition" /> at <xsl:value-of select="@price" /><xsl:text> </xsl:text><b><xsl:value-of select="@quantity * @price" /></b></p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If you still can't get it, you'll need to show all of your code and the XML document you're trying to transform.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old June 15th, 2004, 05:22 AM
zguille zguille is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 zguille User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to zguille
Unhappy my xsl with my 'bad' html tags

Here I attached two files, one with the xml data (I left only 3 nodes), and the one with the xsl code which made the transform. In that file are two lines with html table tags that works fine, I mean, they pass the transfrom correctly, but inside the xsl:if element, the html tags are replaced in the transformation, there is where I have the problem, I need they to remain as they are.
Attached Files
File Type: txt xslTransform.txt (5.8 KB, 241 views)
File Type: txt xmlData.txt (2.2 KB, 242 views)

Reply With Quote
  #4  
Old June 15th, 2004, 04:10 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,569 jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 22 h 42 m 51 sec
Reputation Power: 835
There's a huge and obvious difference in the way you use your HTML in the part where it works and the part where it doesn't. The HTML parts that work are tags by themselves, but in the part that doesn't work, you have them inside <xsl:text> tags and marked as CDATA. Just put the HTML there directly inside the <xsl:if>.
Code:
<xsl:if test="ORDEN='7'"></td></tr></table><table><tr><td></xsl:if>

Reply With Quote
  #5  
Old June 17th, 2004, 05:28 AM
zguille zguille is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 zguille User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to zguille
Thanx for your answer, but this was my first try, and it doesn't work because after the open tag <xsl:if ...> it comes the close tag </td> and it brings an error, /td is not the close tag for xsl:if. That's why I have tried with several different ways, such as CDATA, xsl:text, and so on. I believe it can not be done in the way I was trying. Another solution was found to abtain the result I wanted, is this: instead of proccess every matching xml data, take every 8 node, process it and the following 7, and so on. In that way it can be written the open and close tags properly

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > how can I put html tags into xsl? help please!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT