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

Testing for value of a preceding "cousin"

Subject: Testing for value of a preceding "cousin"
From: Charles Muller <cmuller-lst@xxxxxxxxxxxxxxx>
Date: Thu, 10 Feb 2011 14:55:38 +0900
 Testing for value of a preceding "cousin"
When applying styles to the <date> element within in a TEI <biblStruct> ancestor, such as the following

<biblStruct xml:id="Chen-1964"><monogr><author>Chben, Kenneth</author><title level="m">Buddhism in China: A Historical Survey</title><imprint><pubPlace>Princeton</pubPlace><publisher>Princeton University Press</publisher><date>1964</date></imprint></monogr></biblStruct>

I have, for several years, been using the following simple XSLT,

<xsl:template match="date">
<xsl:if test="(parent::p)">

Thus, in the case of the above, the output would simply be the date, followed by a period.

In the present manuscript that I am working on, the publisher asks that journal dates be placed in parentheses.

Thus, for example, in the following entry

<biblStruct xml:id="Chien-1988"><analytic><author>Chbien, Edward T.</author><title level="a">The Neo-Confucian Confrontation with Buddhism: A Structural and Historical Analysis</title></analytic><monogr><title level="j">Journal of Chinese Philosophy</title><imprint><biblScope type="vol">15</biblScope><date>1988</date><biblScope type="pp">347b348</biblScope></imprint> </monogr></biblStruct>

...since we have <title level="j"> (indicating a journal), I would like the output to be (1988). I know how to test for attribute values in the case of a preceding node, or a sibling, or parent, or ancestor. But in this case, the <title level="j"> element is none of these, although it has the same ancestor. I attempted to deal with this by testing for the existence of a <title level="j"> under the same ancestor of <monogr>

<xsl:template match="date">
<xsl:when test="(parent::p)">
<xsl:when test="//monogr/title[level='j']">

But so far no luck. I was going to try the route of creating a variable when level="j" exists, but I thought that I should ask here to see if there is a way of doing it with standard axes methods.



A. Charles Muller

University of Tokyo
Graduate School of Humanities and Sociology, Faculty of Letters
Center for Evolving Humanities
7-3-1 HongE
, BunkyE
Tokyo 113-0033, Japan

Web Site: Resources for East Asian Language and Thought


Mobile Phone: 090-9310-1787

Current Thread


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.
First Name
Last Name
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.