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

Stumped on XPath

Subject: Stumped on XPath
From: Spencer Tickner <spencertickner@xxxxxxxxx>
Date: Tue, 7 Feb 2006 13:31:31 -0800
 Stumped on XPath
Hi everyone,

Thanks in advance for the help. I've got an interesting match pattern
(I think) I can't seem to get my mind around.

XML
<doc>
 <manual>
  <sentence>This is a sentence with a reference<id ref="1"/> as an
inline element</sentence>
     <clause>This is a clause with inline elements <strong>
and</strong> a reference <id ref="3"/></clause>
</manual>
<appendix>
 <refnote id="1">This is the first reference</refnote>
 </appendix>
 <appendix>
 <refnote id="2">This is the second reference</refnote>
 <refnote id="3">This is the third reference</refnote>
</appendix>
</doc>

Ok, I can't quite figure out the best method for comming up with the
following output

<html>
<body>
<p>This is a sentence with a reference (see Appendix A) as an inline
element</p>
<p class="clause">This is a clause with inline elements <strong>
and</strong> a reference (see Appendix B)</p>
</body>
</html>

So far what I have is:

XSL
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="manual">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="sentence">
  <p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="clause">
 <p class="clause"><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="strong">
<strong><xsl:apply-templates/></strong>
</xsl:template>
<xsl:template match="appendix"/>
<xsl:template match="id">
<!-- This is what I'm having a hard time with -->
<!-- I imagine I have to match the id on the name and then count the
following siblings of appendix and use a translate to get the alpha
value,, but I can't seem to get the syntax down for this -->
</xsl:template>

Well there you go. It's a scaled down version, any thoughts would be
appreciated. Thanks.

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.