xsl-list
[Top] [All Lists]

pulling ID or value-of inside attribute

2004-12-06 21:58:44
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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>