CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Location
    Republic of Ireland
    Posts
    383

    Attributes order after XSLT transformation

    Hi - this is my another problem wyth xslt transformation

    I'm using XSLT below
    Code:
    <xsl:output method="xml" version="1.0" encoding="utf-8" omit-xml-declaration="no"/>
    
    <xsl:template match="/">
    
    <xsl:element name="ofe:ofe" namespace="urn:ofe">
    <xsl:attribute name="wersja">
    <xsl:text>1.0</xsl:text>
    </xsl:attribute>
    </xsl:element>
    and I'm getting result:

    Code:
    <?xml version="1.0"?>
    <ofe:ofe wersja="1.0" xmlns:ofe="urn:ofe"/>
    which it's ok but order of parameters is not correct
    it should be

    Code:
    <?xml version="1.0"?>
    <ofe:ofe xmlns:ofe="urn:ofe" wersja="1.0" />
    Please help - what I have to do to change it?
    Big thanx in advance.

  2. #2
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315

    Re: Attributes order after XSLT transformation

    It would surprise me if that was possible. At least not consistently.
    In XML attributes may not be assigned an order.

    Most likely the XSL processor stores the 2 attributes in a hash table before outputting them, thus their order depends on the order of their hash key values, which could be anything.

    I'am sorry this was probably not the answer you wanted.
    Last edited by khp; April 20th, 2005 at 04:55 AM.
    The biggest problem encountered while trying to design a system that was completely foolproof,
    was, that people tended to underestimate the ingenuity of complete fools.
    Douglas Adams

  3. #3
    Join Date
    Dec 2003
    Location
    Republic of Ireland
    Posts
    383

    Re: Attributes order after XSLT transformation

    Hi,
    maybe I can add one attribute and later (in loop or something) add another assuring in that way correct order of them? Do you think it will be possible?

  4. #4
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315

    Re: Attributes order after XSLT transformation

    No, there's a limit to how much later you can add more attributes to an element in XSL. As soon as you begin producing element content you cannot add more attributes.
    The biggest problem encountered while trying to design a system that was completely foolproof,
    was, that people tended to underestimate the ingenuity of complete fools.
    Douglas Adams

  5. #5
    Join Date
    Dec 2003
    Location
    Republic of Ireland
    Posts
    383

    Re: Attributes order after XSLT transformation

    Quote Originally Posted by khp
    I'am sorry this was probably not the answer you wanted.
    Yes - really. Anyway; thanx for your time. If anything sometime comes to your mind please post it it here. Thanx.

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

Featured