Subject: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Big long xpath, almost th, Wendell Piez | Thread | RE: [xsl] is there a way to extract, Michael Kay |
Re: [xsl] Big long xpath, almost th, Wendell Piez | Date | RE: [xsl] is there a way to extract, Michael Kay |
Month |