[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Updating XML

Subject: Updating XML
From: Marko Petersen <lg002237@xxxxxxxxxxxxxxxx>
Date: Tue, 17 Dec 2002 14:48:36 +0100
simplesect 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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.