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. XML/XSL transformation question.

XML/XSL transformation question.

Scheduled Pinned Locked Moved XML / XSL
xmlquestionwpfregexannouncement
4 Posts 2 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.
  • M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    Howdy' I'm generating some XML files with MSXML; The text is all put on one single line; so I'm trying to transform the document with some XSL "black" magic. The stylesheet (taken from some google-search):

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" />
    <xsl:template match="*">
    xsl:copy
    <xsl:copy-of select="@*" />
    <xsl:apply-templates />
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>

    This works well, except for one minor thing. For empty "tags", the transformation transform :

    <MyTag attribute="value"/>

    to

    <MyTag attribute="value"></MyTag >

    I'm not quite familiar with XSL, and was wondering if there's a way to not create the empty closing tags ? I hope it makes sens. Thanks. Max.

    This signature was proudly tested on animals.

    C 1 Reply Last reply
    0
    • M Maximilien

      Howdy' I'm generating some XML files with MSXML; The text is all put on one single line; so I'm trying to transform the document with some XSL "black" magic. The stylesheet (taken from some google-search):

      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes" />
      <xsl:template match="*">
      xsl:copy
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />
      </xsl:copy>
      </xsl:template>
      </xsl:stylesheet>

      This works well, except for one minor thing. For empty "tags", the transformation transform :

      <MyTag attribute="value"/>

      to

      <MyTag attribute="value"></MyTag >

      I'm not quite familiar with XSL, and was wondering if there's a way to not create the empty closing tags ? I hope it makes sens. Thanks. Max.

      This signature was proudly tested on animals.

      C Offline
      C Offline
      Curtis Schlak
      wrote on last edited by
      #2

      Is there a reason why you don't want the closing tag? Both of the nodes, the one with the /> and the one with the ></MyTag> have the same meaning in XML and should parse the same way....

      "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

      M 1 Reply Last reply
      0
      • C Curtis Schlak

        Is there a reason why you don't want the closing tag? Both of the nodes, the one with the /> and the one with the ></MyTag> have the same meaning in XML and should parse the same way....

        "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        For no other reason than "aestheticism"

        This signature was proudly tested on animals.

        C 1 Reply Last reply
        0
        • M Maximilien

          For no other reason than "aestheticism"

          This signature was proudly tested on animals.

          C Offline
          C Offline
          Curtis Schlak
          wrote on last edited by
          #4

          Yeah, I like it that way, too. No, if you're using MSXML, there's no way to force it to output />. It's hard-coded to do that, as far as I know, having used it for quite a long time.

          "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

          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