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

pulling ID or value-of inside attribute

Subject: pulling ID or value-of inside attribute
From: Benjamin Graff <benjamin.graff@xxxxxxxxx>
Date: Mon, 06 Dec 2004 23:58:44 -0500
benjamin graff
Newbie question here - couldn't find something applicable in other posts...
 
I'm trying to create an <a> tag with the href attribute based partially on text and partially on a unique ID. The final output should be <a href="AQ2004_56_1_X.xml">, where X is the ID number of the article.  When I try something like...
<a> 
 <xsl:attribute name="href">
  <xsl:text>AQ2004_56_1_
  </xsl:text>
  <xsl:value-of select="article_id" />
  <xsl:text>.xml</xsl:text>
 </xsl:attribute>

...the text bits show up when the page is rendered as part of the href path, but the value-of bit with the article_id is nowhere to be found.  I've tested the value-of statement elsewhere in the document and it will pull the article_id number just fine.  I'm just trying to figure out what I'm missing - is there some reason this won't show up?

Applicable code excerpts are below from xml and xslt docs.  The "article_id" as both an attribute and an element in the xml is part of one of my earlier (not so successful) attempts at a fix.  Any help anyone could give me would be most appreciated!  Thank you.
 
***XML excerpt***
<journal>
<table_of_contents>
<article article_id="14">
  <article_id>14</article_id>
  <article_type>Book Review</article_type>
  <title>From Sit-ins to "Shirt-ins": Why Consumer Politics Matter More than Ever</title>
  <author>Kathy M. Newman</author>
  <author_institution>Carnegie Mellon University</author_institution>
  <book_reviewed>A Consumers' Republic: The Politics of Mass Consumption in Postwar America</book_reviewed>
  <book_reviewed_author>Lizabeth Cohen</book_reviewed_author>
  <print_startpage>213</print_startpage>
  <print_endpage>221</print_endpage>
 </article>
</table_of_contents>
</journal>
 
***XSLT excerpt***
<xsl:template match="journal/table_of_contents">
 
<xsl:template match="title">
<a> 
 <xsl:attribute name="href">
  <xsl:text>AQ2004_56_1_
  </xsl:text>
  <xsl:value-of select="article_id" />
  <xsl:text>.xml</xsl:text>
 </xsl:attribute>
 <xsl:attribute name="style">
  <xsl:text>
   font-size:16px;
  </xsl:text>
 </xsl:attribute>
 <xsl:value-of select="." />
</a>
</xsl:template>
 
</xsl:template>

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.