|
[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
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
|
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
|

Cart








