Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 10th, 2005, 03:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT and styling

I am trying to make an XML file, which I want to show using an XSLT document. However, I want to make some words in e.g. a description found in the XML file bold, like in the following...
Code:
<description>This is a <b>demo</b> description.</description>
But it does not seem to be carried over to the XSLT document? Why? How to solve this?

I am aware that the XSLT document is the style sheet, why the style should be placed in this, however I will allow this simple styling from my XML document anyways.

Thanks, Jacob.
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).
Reply With Quote
  #2 (permalink)  
Old October 11th, 2005, 02:02 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It would help if you showed a sample of what you are trying to create. Is it an HTML document?

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old October 11th, 2005, 03:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, sorry. I simply want to do simple markup in the XML file and then have this markup (e.g. the boldface) appear in the HTML document generated using the XSLT document; i.e. when extracting the description value from the XML document I would like the word demo to appear as bold in the browser.

When I try to do this now it seems like the bold tags are disappearing.

The test XML document...
Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<test>
    <description>This is a <b>demo</b> description.</description>
</test>
The XSLT document named test.xsl...
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="test">
        <html>
            <head></head>
            <body><xsl:value-of select="description" /></body>        
        </html>
    </xsl:template>
</xsl:stylesheet>
Thanks, Jacob.
Reply With Quote
  #4 (permalink)  
Old October 11th, 2005, 04:03 AM
mhkay's Avatar
Wrox Author
Points: 18,410, Level: 59
Points: 18,410, Level: 59 Points: 18,410, Level: 59 Points: 18,410, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,949
Thanks: 0
Thanked 289 Times in 284 Posts
Default

xsl:value-of extracts the text of an element and loses any internal mark-up. Use xsl:copy-of.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #5 (permalink)  
Old October 13th, 2005, 02:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot. Works beautifully. Jacob.
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Controls and Styling robzyc ASP.NET 2.0 Basics 4 July 8th, 2008 05:39 AM
PHP Styling adaniels11 PHP How-To 1 April 10th, 2007 05:10 AM
Styling pie charts in SSRS 2005 Dangermouse BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 February 20th, 2007 06:28 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM
Nav Bar Styling VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 May 16th, 2006 06:02 PM



All times are GMT -4. The time now is 04:37 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.