Jump to content
  • Advertisement
Sign in to follow this  
KittyRa

[web] Text styling with XSLT

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a web page in XSLT and I want to be able to style text by using <i></i> tags (or something like that) but when I put them in the xml file nothing changes. How can I style my text (I want to be able to bold and do italics and stuff). This is where the stuff goes. I would like to be able to style the description.
. . .<table width="200" border="1">
    <xsl:for-each select="namelist/names/item">
      <tr>
          <td height="55"><a href="{link}"><xsl:value-of select="name"/></a> - <xsl:value-of select="description"/></td>
      </tr>
    </xsl:for-each>
. . .
This is what the xml file is like:
<?xml version="1.0"?>
<people>
    <item>
        <name>Glockasnobbieshcan</name>
        <description>This is a descriptiodk fjkjfkkjdkljv,m</description>
        <link>http://www.google.com/</link>
    </item>

    <item>
        <name>Glockasnobbieshcan</name>
        <description>This is a descriptiodk fjkjfkkjdkljv,m</description>
        <link>http://www.google.com/</link>
    </item>

    <item>
        <name>Glockasnobbieshcan</name>
        <description>This is a descriptiodk fjkjfkkjdkljv,m</description>
        <link>http://www.google.com/</link>
    </item>
. . .
</people>
Any help would be greatly appreciated. (I'm pretty sure I can't spell)

Share this post


Link to post
Share on other sites
Advertisement
Try using "& lt ;em & gt ;" (spaces inserted to prevent HTMLization) instead of <em>, it should work (too lazy to check though). When you insert pure HTML into XML you're making more nodes (I'd think).

Share this post


Link to post
Share on other sites
I tried it but it doesn't work.

EDIT: I also tried that but it just ends up putting <em> </em> around the text.

Share this post


Link to post
Share on other sites
shouldn't your select statement read


<xsl:for-each select="people/item">


rather than


<xsl:for-each select="namelist/names/item">


or am i missing something?

Share this post


Link to post
Share on other sites
Quote:
Original post by 6
shouldn't your select statement read


<xsl:for-each select="people/item">


rather than


<xsl:for-each select="namelist/names/item">


or am i missing something?
Oh, yeah it should. I just forgot to change them. They were from an old project because I don't have the stuff I'm working on now with me and I was too lazy to open 2 files (yet, for some reason, I was suddenly un-lazy enough to type up the first item and copy and paste it).

Share this post


Link to post
Share on other sites
I think you might need something like <xsl:output method="text/html"/> or something like that near the beginning of your file...perhaps :)

Share this post


Link to post
Share on other sites
I already had something like that in the file so that can't be it...

<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD HTML 4.01 Strict//EN" doctype system="http://www.w3.org/TR/html4/strict.dtd"/>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!