[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Updating XML
Hi,
I am trying to insert some elements into a XML file, but I don't know exactly how the XML looks like, I only know the DTD. So I tried to break it down and got a working stylesheet, but it seems not to be a very good solution, I always use not(name() = 'elementname') and I think that there might be a better and simpler solution. I tried somesthing like not(elementname), but this does not work. The following is the style, I deleted some elements to check for, the original checks for some more elements, but this will show what I mean. <xsl:template match="section | chapter"> <xsl:copy> <xsl:apply-templates select="@*"/> <!-- apply all elments except section, simplesect, index and bibliography, but also apply index and bibliography, if they are followed by an element which is not index or bibliography --> <xsl:apply-templates select="*[( not(name() = 'section') and not(name() = 'simplesect') and not(name() = 'index') and not(name() = 'bibliography') ) or ( ( name() = 'index' or name() = 'bibliography' ) and following-sibling::*[ not(name() = 'index') and not(name() = 'bibliography') ])]"/> <!-- do something --> <para role="annotation.new"/> <!-- now apply section, simplesect and all index and bibliography elements, which are not followed by an element which is other than index or bibliography. --> <xsl:apply-templates select="section | simplesect | *[ ( name() = 'index' or name() = 'bibliography') and not(following-sibling::*[not( name() = 'index' or name() = 'bibliograpy' )])]"/> </xsl:copy> </xsl:template> Has anybody an idea how to make the above style a little more simple? Or how to get the same result an easier way? Thanks for help and greetings, Marko XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|