Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2012, 09:39 PM
Authorized User
 
Join Date: Jan 2012
Posts: 17
Thanks: 7
Thanked 0 Times in 0 Posts
Default Matching multiple XPaths in xsl:template

hi all -

Thanks for reading. Is it possible to match multiple XPaths in a single <xsl:template match="">?

I have the following two file types:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<TEI.2 id="1234_001">
    <teiHeader>
        <fileDesc>
            <titleStmt>
                <title>Letter (copy), <name>BDS</name> at University, to Wrox, <date value="2011-10-31">2011 Oct. 31</date>
                </title>
                <author>
                    <name>BDS</name>
                </author>
            </titleStmt>
            <publicationStmt>
                <publisher>University Special Collections</publisher>
                <date>2011-10-31</date>
                <idno type="spcId">1234_001</idno>
            </publicationStmt>
            <sourceDesc>
                <bibl>
                    <title>Letter (copy), <name>BDS</name> at University, to Wrox, <date value="2011-10-31">2011 Oct. 31</date>
                    </title>
                </bibl>
            </sourceDesc>
        </fileDesc>
    </teiHeader>
</TEI.2>
and
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ead>
    <eadheader>
        <eadid>1234</eadid>
        <filedesc>
            <titlestmt>
                <titleproper>Finding Aid Title <num>MS.0000</num>
                </titleproper>
            </titlestmt>
            <author>Finding aid prepared by BDS, October 31, 2011</author>
        </filedesc> 
        <profiledesc>
            <creation>Finding aid produced by hand
                <date>2011-10-31T11:20-0400</date>
            </creation>
        </profiledesc>
    </eadheader>
    <archdesc>
        <did>
            <unittitle>Find Aid Title,</unittitle>
            <unitid>MS.0000</unitid>
            <repository>
                <corpname>University Libraries, Special Collections</corpname>
            </repository>
            <unitdate>1912</unitdate>
        </did>
    </archdesc>
    <controlaccess>
        <head>Subjects</head>
        <subject>Subject 1</subject>
        <subject>Subject 2</subject>
        <subject>Subject 3</subject>
        <subject>Subject 4</subject>
    </controlaccess>
</ead>
I would like to access the following XPaths in the separate documents:
/ead/archdesc/did/unitdate[1]
/TEI.2/teiHeader/fileDesc/publicationStmt/date[1]

Is something along the lines of
Code:
xsl:template match="[/ead/archdesc/did/unitdate[1] or /TEI.2/teiHeader/fileDesc/publicationStmt/date[1]]"
possible?

Thanks in advance for any suggestions you can offer.
 
Old January 10th, 2012, 04:34 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

http://www.w3schools.com/xpath/xpath_syntax.asp

See "Selecting several paths" near the bottom.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
CanOfBees (January 10th, 2012)
 
Old January 10th, 2012, 12:39 PM
Authorized User
 
Join Date: Jan 2012
Posts: 17
Thanks: 7
Thanked 0 Times in 0 Posts
Default

samjudson --

Thanks very much for the reply. That get's me a step closer to a solution!

Cheers!





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use multiple template in the xsl file? dhrumil XSLT 2 April 1st, 2010 04:04 AM
using 3 XPaths to index using xsl:key Chamkaur XSLT 3 March 2nd, 2007 04:09 AM
Need help with matching multiple "begins-wth" dcheslow XSLT 3 January 18th, 2007 04:32 AM
xsl matching with single file javaclimber XSLT 2 September 14th, 2005 12:16 AM
XSLT - First Time Matching a Template highlife XSLT 4 July 25th, 2003 07:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.