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

xsl:if testing elements (was: Re: Select on Text Node, XML O

Subject: xsl:if testing elements (was: Re: Select on Text Node, XML Out ofAncestors)
From: John Robert Gardner <jrgardn@xxxxxxxxx>
Date: Mon, 1 Nov 1999 20:45:45 -0500 (EST)
xsl if text node
The template match for the xsl:if discussed on this subject bears
similarly upon what I'd asked about this morning.  Emory is having
inconceivable server problems for a university with it's funds, so I was
messed up in sending/replying sooner (and many thanks to those who had
patience with me on this, most recently Ken Holman).

The efforts of David Carlisle offlist are much appreciated, the following
script will pull all "records" wherein the PCDATA of a subfield is
0039-0310X with this XML  (apologies for not posting suitable sample code
sooner):

<root>
<record>
                <data-field tag="600" ind1="1" ind2="4">
                        <subfield code="d">1904-1984.</subfield>
                </data-field>
                <data-field tag="650" ind2="4">
                        <subfield code="a">Cognition.</subfield>
                </data-field>
                <data-field tag="773" ind1="0">
                        <subfield code="a">Studia Canonica</subfield>
                        <subfield code="x">0039-310X</subfield>
                </data-field>
        </record>
<record>
                <data-field tag="600" ind1="1" ind2="4">
                        <subfield code="d">numbers of stuff</subfield>
                </data-field>
                <data-field tag="650" ind2="4">
                        <subfield code="a">thoughts.</subfield>
                </data-field>
                <data-field tag="773" ind1="0">
                        <subfield code="a">Something</subfield>
                        <subfield code="x">0999-440X</subfield>
                </data-field>
        </record>
</root>

WIth this Stylesheet

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
  <xsl:output type="xml" indent="yes" /> 

 <xsl:template match="root">
 <xsl:copy>
  <xsl:apply-templates mode="copy"
	select="record[data-field/subfield='0039-0310X']" /> 
  </xsl:copy>
  </xsl:template>

 <xsl:template mode="copy" match="*">
 <xsl:copy>
  <xsl:copy-of select="@*" /> 
  <xsl:apply-templates mode="copy" /> 
  </xsl:copy>
  </xsl:template>
  </xsl:stylesheet>

John Robert Gardner



 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.