Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 21st, 2003, 01:53 PM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default converting cross refs between HTML documents

I'm trying to use XSLT to convert an XML book into multiple HTML files, and I'm having an issue with cross references betweent the files.

The book is made up of multiple chapters, and I'm outputting each chapter as a separate HTML file-- chapter 1 is output as ch_1.html, and so on--using <xsl:number>. Within the chapters are Xref elements with an id attribute. I can create the text of the cross reference just fine:

<a href="#{@Target}">See <xsl:value-of select="id(@Target)/Head"/></a>

This works just fine for xref destinations within the same HTML file. The problem is that for a destination in a different HTML file, I can't figure out how to get the filename of the HTML file in the hypertext link. The Xref elementsare descendants of the Chapter element, but they aren't immediate children, and the number of elements between the Chapter and the Xref elements can vary.

Any ideas how I can get the destination filename in the hypertext link?

FYI, the DTD looks like this:

<!ELEMENT Manual (Chapter+)>
<!ELEMENT Chapter (title, Section*)>
<!ELEMENT Section (Head, Body*, Section*)>
<!ELEMENT Body (#PCDATA | Xref)*>
<!ELEMENT Xref Empty>
                        format CDATA #IMPLIED>
Reply With Quote
  #2 (permalink)  
Old October 22nd, 2003, 12:21 AM
Friend of Wrox
Join Date: Jun 2003
Location: Nor Hachin, Kotayk, Armenia.
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to armmarti

Try this:

<a href="ch_{count(id(@Target)/ancestor::Chapter[1]/preceding-sibling::*)+1}.html#{@Target}">See <xsl:value-of select="id(@Target)/Head"/></a>
Reply With Quote
  #3 (permalink)  
Old October 22nd, 2003, 11:00 AM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

You're a genius--that worked perfectly. Thanks!

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting PDF to HTML sunil.konduri C# 2005 1 July 11th, 2008 07:34 AM
converting from html to aspx sss22 ASP.NET 1.0 and 1.1 Basics 1 February 2nd, 2006 05:48 AM
converting self-nested xml to html its_vippy XSLT 1 June 1st, 2005 04:47 AM
Appending HTML documents to a Crystal Report hangar18 Crystal Reports 0 February 7th, 2005 04:48 AM
Q. PHP and HTML documents standards compliance richard.york PHP FAQs 0 June 28th, 2004 09:33 PM

All times are GMT -4. The time now is 08:02 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.