473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

xslt, xml and tables .. how to do it

i have data in xml

i want them to display in html (<table>). i can do it, but i don't
know how to change <tr bgcolor="...">

i use

<xsl:template match="spolka">

<tr>
<td><xsl:value-of select="nazwa"/></td>
<td align="right"><xsl:value-of select="kapital"/></td>
<td align="right"><xsl:value-of select="udzial"/></td>
<td align="right">
<xsl:if test=" www='' ">
brak www
</xsl:if>
<xsl:if test=" www!='' ">
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of
select="www"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:value-of select="www"/>
</xsl:element>
</xsl:if>
</td>
</tr>

</xsl:template>
<xsl:template match="podgrupa">
<tr><td colspan="4" align="center"><strong><xsl:value-of
select="rodzaj"/></strong></td></tr>
<xsl:apply-templates select="spolka"/>
</xsl:template>

the other thing is how to make a working <a href=""..
i make it with element and attributes .. but is there any easier
method?

(sorry for my bad english)
Jul 20 '05 #1
1 1345
ei********@wp.pl (Wredniak) wrote in message
the other thing is how to make a working <a href=""..
i make it with element and attributes .. but is there any easier
method?


try using parameters or variables

this works for me and creates an <A HREF=""> with an HREF that works.
It wouldn't let me make the <A> element like the <TABLE> but it's
still fairly
short.

I use MSXML 4.0 SP2.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">
<xsl:param name="PCLevel">7</xsl:param>
<xsl:param name="HTHType">Basic</xsl:param>
<xsl:param name="url">C:\Program Files\RPC\hold.html</xsl:param>

<HEAD>
<LINK href="c:\program files\rpc\program\RPC.css" type="text/css"
rel="stylesheet"/>
</HEAD>
<HTML>
<BODY>
<TABLE width="65%" style="border-collapse: collapse" class="blue
frame" border="1" cellspacing="0" cellpadding="2">
<CAPTION class="bigblue"><xsl:value-of select="$HTHType"/></CAPTION>
<TH>Level</TH><TH>Information</TH>
<xsl:for-each select="document('C:\Program
Files\RPC\Data\File.Details')//HTH">
<xsl:comment>Here's Document 1!</xsl:comment>
<xsl:if test="(@Name = $HTHType)">
<TR bgcolor="whitesmoke"> <-- this works fine too!
<TD align="middle"><a><xsl:attribute name="href"><xsl:value-of
select="$url"/></xsl:attribute></a>
<xsl:value-of select="@Level"/></TD>
<TD>
<xsl:if test="@Text = ''">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="@Text"/>
</TD>
</TR>
</xsl:if>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: øystein | last post by:
Hi! I got an xml file that goes like this. <question id=10 correct_answer=2> <alternative>Answer 1</alternative> <alternative>Answer 2</alternative> <alternative>Answer 3</alternative>...
5
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT)...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
2
by: Scamjunk | last post by:
I have been desperately looking for a treeview-type solution for my problem for the past three weeks and have been greatly unsuccessful. I am totally new to the world of XSLT and I *don't know*...
6
by: Pete Verdon | last post by:
Summary: Can I do an XSLT transform, in the client, of a tree of nodes taken from the displayed page DOM in IE? This works in Firefox. Hi, I'm just starting the process of rewriting part of a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.