|
Subject: [xsl] Updating XML From: Marko Petersen <lg002237@xxxxxxxxxxxxxxxx> Date: Tue, 17 Dec 2002 14:48:36 +0100 |
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?
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Fibonacci & XSL, Dimitre Novatchev | Thread | Re: [xsl] Updating XML, Jeni Tennison |
| RE: [xsl] Extending Xhtml2fo.xsl to, Graham Hannington | Date | RE: [xsl] Fibonacci & XSL, bryan |
| Month |