Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Different color within the same node

Different color within the same node

Scheduled Pinned Locked Moved XML / XSL
xmltutorialquestionannouncement
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johncode23
    wrote on last edited by
    #1

    I'm completelly new to XML/XSL so bare with me. I'm trying to use different colors within the same node... In the following example: __________________________________________________ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <example> <title> This is the title </title> <text> This is a sample text. I want to make next word <g>GREEN<g> I want to make this one <r>RED<r> </text> </example> _____________________________________________________________ What should style.xsl be so that the word "GREEN" appears green and same with "RED" once I open it with the browser? Is there an easier way to code the XML in order to achieve that? Thanks!

    J 1 Reply Last reply
    0
    • J johncode23

      I'm completelly new to XML/XSL so bare with me. I'm trying to use different colors within the same node... In the following example: __________________________________________________ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <example> <title> This is the title </title> <text> This is a sample text. I want to make next word <g>GREEN<g> I want to make this one <r>RED<r> </text> </example> _____________________________________________________________ What should style.xsl be so that the word "GREEN" appears green and same with "RED" once I open it with the browser? Is there an easier way to code the XML in order to achieve that? Thanks!

      J Offline
      J Offline
      johncode23
      wrote on last edited by
      #2

      Ok... I found the answer to my own question(below), but can I achieve the same result some other way, so I don't have to create nodes for it? It is very time consuming to edit the text in that manner... Thanks again! ________________________________ <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="r"> <font color="red">xsl:apply-templates/</font> </xsl:template> <xsl:template match="g"> <font color="green">xsl:apply-templates/</font> </xsl:template> </xsl:stylesheet> ____________________________________

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups