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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 24th, 2003, 07:00 AM
mikefmi mikefmi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 mikefmi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Html-tag attribute creation using XSLT

Hello, folks!
I have the xml file:
<xtag>
xvalue
</xtag>

and I need to create HTML-output using XSLT, that must look like this:

<htmltag attribute="foo and xvalue">

- the attribute value for this tag must include a text node from xml file. How to gain this with XSLT? Help me, please..

Reply With Quote
  #2  
Old November 25th, 2003, 04:16 PM
tsprings tsprings is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Seattle, WA
Posts: 55 tsprings User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 5
Try this:

Here is your xml file:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="mikefmi.xsl" ?>
<!DOCTYPE xtag [<!ELEMENT xtag (#PCDATA)>]>
<xtag>
xvalue
</xtag>

And here is mikefmi.xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<!--Select the value of xtag, put everything where the period is.
I commented out the information you wanted, and put in an
image so you could easily see it at work. The htmltag that you
wanted should work just as like the img. -->
<xsl:for-each select="xtag">
<!--<htmltag attribute="foo and {.}"></htmltag>-->
<img src="http://www.ephratafirstbaptist.com/images/newBlueLogoSmall.jpg" alt="foo and {.}" />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Hopefully this helps!

Reply With Quote
  #3  
Old November 26th, 2003, 01:52 AM
mikefmi mikefmi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 mikefmi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks you!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Html-tag attribute creation using XSLT


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway