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. White Space Preservation In Xslt

White Space Preservation In Xslt

Scheduled Pinned Locked Moved XML / XSL
xmlhelptutorial
5 Posts 3 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.
  • T Offline
    T Offline
    Tristan Rhodes
    wrote on last edited by
    #1

    I've made an Xslt as a template for a code generator i'm working on. It seems to be getting the bulk of it right, but where i have two Xsl attribute blocks consecutively with only white space in between them, it gets stripped. I had a look around and couldn't find anything. Here is my example: public <xsl:value-of select="type"/> <xsl:value-of select="name"/> { // Property Logic } This produces: public DateMyDOB { // Property Logic } It's lame :( If anyone can help, that'd be great. Cheers Tris

    ------------------------------- Carrier Bags - 21st Century Tumbleweed.

    G 1 Reply Last reply
    0
    • T Tristan Rhodes

      I've made an Xslt as a template for a code generator i'm working on. It seems to be getting the bulk of it right, but where i have two Xsl attribute blocks consecutively with only white space in between them, it gets stripped. I had a look around and couldn't find anything. Here is my example: public <xsl:value-of select="type"/> <xsl:value-of select="name"/> { // Property Logic } This produces: public DateMyDOB { // Property Logic } It's lame :( If anyone can help, that'd be great. Cheers Tris

      ------------------------------- Carrier Bags - 21st Century Tumbleweed.

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      Tris, One way to solve this is to use xsl:text:

      public <xsl:value-of select="type"/>xsl:text </xsl:text><xsl:value-of select="name"/>
      {
      // Property Logic
      }

      You can also use the nonbreaking space character, " " , also.

      "We make a living by what we get, we make a life by what we give." --Winston Churchill

      T P 2 Replies Last reply
      0
      • G George L Jackson

        Tris, One way to solve this is to use xsl:text:

        public <xsl:value-of select="type"/>xsl:text </xsl:text><xsl:value-of select="name"/>
        {
        // Property Logic
        }

        You can also use the nonbreaking space character, " " , also.

        "We make a living by what we get, we make a life by what we give." --Winston Churchill

        T Offline
        T Offline
        Tristan Rhodes
        wrote on last edited by
        #3

        Thankyou sir. That'll do nicely.

        ------------------------------- Carrier Bags - 21st Century Tumbleweed.

        1 Reply Last reply
        0
        • G George L Jackson

          Tris, One way to solve this is to use xsl:text:

          public <xsl:value-of select="type"/>xsl:text </xsl:text><xsl:value-of select="name"/>
          {
          // Property Logic
          }

          You can also use the nonbreaking space character, " " , also.

          "We make a living by what we get, we make a life by what we give." --Winston Churchill

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Ah, so that's how you get a nonbreaking space!! Thanks! I'll have to write that down. I've been using <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> to insert one into HTML.

          G 1 Reply Last reply
          0
          • P PIEBALDconsult

            Ah, so that's how you get a nonbreaking space!! Thanks! I'll have to write that down. I've been using <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> to insert one into HTML.

            G Offline
            G Offline
            George L Jackson
            wrote on last edited by
            #5

            The entity   does not exist in XSLT, so you have to use the code.

            "We make a living by what we get, we make a life by what we give." --Winston Churchill

            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