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

RE: xsl escaping


xsl escaping
You want the attribute value template [1]. Note lines 3 and 7.

 1  <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 2  <xsl:output indent="yes" omit-xml-declaration="yes"/>
 3  <xsl:variable name="tt" select="tocTitle"/>
 4
 5  <xsl:template match="tocTitle">
 6   <tr><td>
 7    <a href="{$tt}">
 8     <xsl:apply-templates />
 9    </a>
10   </td></tr>
11  </xsl:template>
12
13  </xsl:stylesheet>

which when applied to the document below (with Saxon, e.g.):

<tocTitle>tocdoc</tocTitle>

will yield:

<tr>
   <td>
      <a href="tocdoc">tocdoc</a>
   </td>
</tr>

[1] http://www.w3.org/TR/xslt#attribute-value-templates

 -----Original Message-----
> From: Molnar, Chris [mailto:Chris.Molnar@u...]
> Sent: Thursday, May 23, 2002 12:10 PM
> To: 'xml-dev@l...'
> Subject:  xsl escaping
>
>
> I am trying to parse the following xsl into html:
> ---
> <xsl:template match="tocTitle">
> 	<tr><td>
>
> 	<a href="#<xsl:apply-templates select="tocTitle" />">
> 		<xsl:apply-templates />
> 	</a>
>
> 	</td></tr>
> </xsl:template>
> ---
>
> I cannot figure out how to grab the value of tocTitle and reuse it. In a
> nutshell, I have a form that users fill out that creates an html
> page. I am
> allowing them to create an in-page table of contents by entering
> a name for
> each TOC entry. The I want to reuse the text they enter in the final html
> doc in the following three ways:
> 1. as the text of the TOC entry
> 2. as the in-page link (#link)
> 3. as the named anchor the respective link points to
>
> I tried to illustrate this in the non well-formed code above. Any ideas on
> how I could make this work?
>
> Thanks,
> Chris
>
> ____________________________________
> Chris Molnar
> Content Management & Intranet Consulting
> office 773-399-4133
> cell 773-230-7076
>
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>


  • References:

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.