Results 1 to 2 of 2

Thread: XSLT problems

  1. #1

    Thread Starter
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    XSLT problems

    I am trying to write an XSL Template that transforms some raw XML into an alternative form. It is a little difficult to describe: -

    I am trying to insert some plain text tags into the XML output. So, I have an xsl:choose setup with three different scenarios. If you imagine I have header and body data. Each time I hit a certain tag I want to close one section and create a new section. So I have as below: -

    <xsl:choose>
    <xsl:when test="headeritem">
    '''''''''''''''some code
    </xsl:when>
    <xsl:when test="line item">
    '''''''''''''''some code
    </xsl:when>
    <xsl:otherwise>
    <!-- here I want to now add a closing tag to a section above -->
    </body>
    <header>
    <body>
    </xsl:when>

    what happens is the XML parser says that the /body tag doesn't match the xsl:otherwise tag. Does anybody know how I can output random tags where and when I want to?

    Please please help!

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    This is not allowed b/c your output is not well-formed. You must output escape the text nodes in order for this to work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width