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

is there a way to extract the text from a tag?

Subject: is there a way to extract the text from a tag?
From: "Catherine Winston" <cwinston@xxxxxxxxxxx>
Date: Thu, 16 Apr 2009 15:03:42 -0400
 is there a way to extract the text from a tag?
My overall question: Is there a way to extract CREATOR from the
<dc:creator> tag, using xsl?

I am trying to produce a csv document from an existing xml file (Sample
1 below); using my xsl (Sample 2 below) I have been able to display the
information as a csv file (Sample 3 below), but now I am noticing that I
do not have the first line of information that I need (the field names)
- and that that information is living within the tags of the xml file.

Sample 1 (from my xml file):
<?xml version="1.0" encoding="UTF=16"?><digital_entity><pid>261315</pid>
	<record xmlns=.................>
	<dc:title>Olymic Zone</dc:title>
	<dc:title>exterior; The Athlete (life-size; high relief in
concrete and stone); outside Stadium</dc:title>
	<dc:title></dc:title>
	<dc:creator>Gregotti, Vittorio</dc:creator>
	<dc:creator>birth: 1927</dc:creator>
	.............

Sample 2 (from my xsl file):
<?xml verison="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:..................>
	<xsl:output method="text" encoding="UTF-8" indent="no" />
	<xsl:template match="/">
		<record>
			<pid>
				<text>"</text><xsl:value-of
select="//pid"/><text>","</text>
			</pid>
			<xsl:for-each select="//dc:title">
				<dc:title>
					<xsl:value-of
select="."/><text>","</text>
				</dc:title>
			</xsl:for-each>
			<xsl:for-each select="//dc:creator">
				<dc:creator>
					<xsl:value-of
select="."/><text>","</text>
				</xsl:for-each>
				..................

Sample 3 (from my csv file): (this is the very beginning of the first
line of text within my csv file)
"261315","Olympic Zone","exterior; The Athelete (life-size; high relief
in concrete and stone); outside Stadium","","Gregotti,
Vittorio","birth:1927",....................

I have now fathomed that I need to have -
pid,title,title,title,creator,creator,........... as my first line of
text.

Another 'problem' is that each record that I am going to be working with
will not have the same tags or the same number of the same tags (e.g.
one record may have three <dc:creator> tags but another may have only
one <dc:creator> tag, or none at all) - so if I could extract the 'text'
from the tags themselves in the process of creating each csv file - that
would solve my problem.

Any help would be greatly appreciated!
Katie

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.