html String from Xml in Xlst

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WStoreyII

    html String from Xml in Xlst

    Hello,

    I have a cgi program made in c which will output xml that I have
    obtained from a mysql database. I have the xml output setup to be
    transformed by blog.xsl in the header of the xml output.

    My problem is that one of the element of the xml will be a element
    called article
    which will contain a text string that has html tags from the msyql
    database. what i want is that in the xsl it slaps the article element
    in to a div then the formating should be done by the tags in the
    string.

    for some reason though this does not work.

    if you need to see the file let me know.

    Thanks for the help.

    WStoreyII

  • WStoreyII

    #2
    Re: html String from Xml in Xlst

    i forgot to mention that in the output it reads the tags becuase it
    does not print them but it does not render the data according to the
    tag.

    so maybe it is a browser setting.
    i am using firefox if that helps.

    Comment

    • Malte

      #3
      Re: html String from Xml in Xlst

      WStoreyII wrote:[color=blue]
      > Hello,
      >
      > I have a cgi program made in c which will output xml that I have
      > obtained from a mysql database. I have the xml output setup to be
      > transformed by blog.xsl in the header of the xml output.
      >
      > My problem is that one of the element of the xml will be a element
      > called article
      > which will contain a text string that has html tags from the msyql
      > database. what i want is that in the xsl it slaps the article element
      > in to a div then the formating should be done by the tags in the
      > string.
      >
      > for some reason though this does not work.
      >
      > if you need to see the file let me know.
      >
      > Thanks for the help.
      >
      > WStoreyII
      >[/color]
      CDATA?

      Comment

      • WStoreyII

        #4
        Re: html String from Xml in Xlst

        could you maybe explain more about cdata and how that would help or how
        i need
        to implement it to get what i want.

        Comment

        • Malte

          #5
          Re: html String from Xml in Xlst

          WStoreyII wrote:[color=blue]
          > could you maybe explain more about cdata and how that would help or how
          > i need
          > to implement it to get what i want.
          >[/color]

          Well, you did not say, exactly what or why it did not work. I assumed
          that the XSL processor complained about (possibly) not welformed tags in
          the xml. In a similar application we had the xsl template for the tag,
          the article tag in your case, wrap a <![CDATA[ ]]> around the offending
          text. This is how we were able to take all sorts of javascript and pass
          through to the browser.

          Comment

          • WStoreyII

            #6
            Re: html String from Xml in Xlst

            thank you for the help,

            i tried that and now it just shows the tags and text as a string.
            before it was not showing the tags just the text but it was not parsing
            the tags.
            i hope that makes sense.

            Comment

            • Peter Flynn

              #7
              Re: html String from Xml in Xlst

              Malte wrote:
              [color=blue]
              > WStoreyII wrote:[color=green]
              >> Hello,
              >>
              >> I have a cgi program made in c which will output xml that I have
              >> obtained from a mysql database. I have the xml output setup to be
              >> transformed by blog.xsl in the header of the xml output.
              >>
              >> My problem is that one of the element of the xml will be a element
              >> called article
              >> which will contain a text string that has html tags from the msyql
              >> database. what i want is that in the xsl it slaps the article element
              >> in to a div then the formating should be done by the tags in the
              >> string.
              >>
              >> for some reason though this does not work.
              >>
              >> if you need to see the file let me know.
              >>
              >> Thanks for the help.
              >>
              >> WStoreyII
              >>[/color]
              > CDATA?[/color]

              Probably not. See the FAQ: http://xml.silmaril.ie/authors/cdata/

              ///Peter
              --
              sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
              &;top"

              Comment

              • Peter Flynn

                #8
                Re: html String from Xml in Xlst

                WStoreyII wrote:
                [color=blue]
                > Hello,
                >
                > I have a cgi program made in c which will output xml that I have
                > obtained from a mysql database. I have the xml output setup to be
                > transformed by blog.xsl in the header of the xml output.
                >
                > My problem is that one of the element of the xml will be a element
                > called article
                > which will contain a text string that has html tags from the msyql
                > database. what i want is that in the xsl it slaps the article element
                > in to a div then the formating should be done by the tags in the
                > string.
                >
                > for some reason though this does not work.[/color]

                At a guess because the embedded markup is not well-formed (eg corrupt,
                non-HTML, or just uses mismatched case, or missing end-tags). If the
                data owner wants XML output, then the input must be clean to start with.

                ///Peter
                --
                sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
                &;top"

                Comment

                • Peter Flynn

                  #9
                  Re: html String from Xml in Xlst

                  WStoreyII wrote:
                  [color=blue]
                  > thank you for the help,
                  >
                  > i tried that and now it just shows the tags and text as a string.
                  > before it was not showing the tags just the text but it was not parsing
                  > the tags.
                  > i hope that makes sense.[/color]

                  Using CDATA is usually wrong in these circumstances.
                  Fixing the data so that it is correct is usually a better approach.

                  ///Peter
                  --
                  sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
                  &;top"

                  Comment

                  Working...