XSLT inserting once off custom text

Posted by BeraCim on Stack Overflow See other posts from Stack Overflow or by BeraCim
Published on 2010-04-23T01:44:58Z Indexed on 2010/04/23 1:53 UTC
Read the original article Hit count: 296

Filed under:
|

Hi all:

The folloiwng is a pre-existing xml file. I was wondering how can I insert a element before the first element using xslt?

<XmlFile>
    <!-- insert another <tag> element here -->
    <tag>
        <innerTag>
        </innerTag>
    </tag>
    <tag>
        <innerTag>
        </innerTag>
    </tag>
    <tag>
        <innerTag>
        </innerTag>
    </tag>
</XmlFile>

I was thinking of using a for-each loop and test the position = 0, but upon the first occurence of the for-each its already too late. This is a once-off text so I can't combine it with other xslt templates that are already inside the xsl file.

Thanks.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xsl