|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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.. |
|
#2
|
|||
|
|||
|
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! |
|
#3
|
|||
|
|||
|
Thanks you!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Html-tag attribute creation using XSLT |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|