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

Remove internal parsing and exclude one child

Subject: Remove internal parsing and exclude one child
From: "Charles O'Connor coconnor@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 May 2017 17:29:19 -0000
 Remove internal parsing and exclude one child
Hi,

Using XSLT 1.0/Saxon9he

I have this input

<aff id="aff1"><label>1</label>Jet Propulsion Laboratory (JPL), 4800 Oak Grove
Dr Pasadena, CA <addr-line><postal-code>91109</postal-code>,
<country>USA</country></addr-line></aff>
<aff id="aff2"><label>2</label>SCRIPPS Institution of Oceanography, 9500
Gilman Drive, <institution>Dept 0230</institution>, <addr-line><city>La
Jolla</city>, <state>CA</state>
<postal-code>92093-0230</postal-code></addr-line>,
<country>USA</country></aff>

And would like to get the same back, without the internal parsing and
excluding the contents of <label>, e.g.,

<aff id="aff1">Jet Propulsion Laboratory (JPL), 4800 Oak Grove Dr Pasadena, CA
91109, USA</aff>
<aff id="aff2">SCRIPPS Institution of Oceanography, 9500 Gilman Drive, Dept
0230, La Jolla, CA 92093-0230, USA</aff>

Using this .xsl

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
 </xsl:template>

 <xsl:template match="//aff">
     <aff id="{@id}">
       <xsl:value-of select="."/>
    </aff>
 </xsl:template>

</xsl:stylesheet>

I get all the text in <aff>, including the text in <label>.

<aff id="aff1">1Jet Propulsion Laboratory (JPL), 4800 Oak Grove Dr Pasadena,
CA 91109, USA</aff>
<aff id="aff2">2SCRIPPS Institution of Oceanography, 9500 Gilman Drive, Dept
0230, La Jolla, CA 92093-0230, USA</aff>

I've tried various permutations of

<xsl:value-of select="./node()[not(self::label)]"/>

but I either lose the text from the descendants or repeat it. How do I get all
the text but drop the contents of <label>?

Thanks,
Charles

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.