|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Creating Forward/Backward HTML links from multi-file X
I am using XSL to translate a set of XML documents into a corresponding set of HTML documents. I am stuck trying to figure out how to create <a > ... </a> links in HTML that display forward and backward pointers through the web pages. Each XMl document represents one "topic" in a class. The file class.xml is: <<<<< <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE class [ <!ENTITY pINTRODUCTION SYSTEM "introduction.xml" > <!ENTITY pOVERVIEW SYSTEM "overview.xml" > <!ENTITY pOVERVIEW2 SYSTEM "overview2.xml" > ]> <class>
&pINTRODUCTION;
&pOVERVIEW;
&pOVERVIEW2;
</class>>>>>> Each topic has the following (partial) structure: <<<<< <topic>
<!-- Used to link topics together -->
<menu>
<file>overview</file>
<display>overview</display>
<next>overview2</next>
<prior>introduction</prior>
</menu>
<course>Course Name</course>
<section>Overview</section>
<title>Overview</title>
<abstract></abstract><!--- removed --> </topic> >>>>> Notice that I embed knowledge of the <next/> and <prior/> topic names into each topic file. This has allowed me to use the following code to create forward/backward pointers: <<<<< <div id="navigation">
<xsl:variable name="menu-prior" select="menu/prior"/>
<xsl:value-of select="menu-prior"/>
<xsl:if test="(menu/prior) or (menu/next)">
<ul>
<xsl:if test="menu/prior">
<li><a href="{menu/prior}.html">prior</a></li>
</xsl:if>
<xsl:if test="menu/next">
<li><a href="{menu/next}.html">next</a></li>
</xsl:if>
</ul>
</xsl:if>
</div>>>>>> Is there a better solution to this? I would prefer to keep the meta information about topic sequence out of each topic file. Basically, as I understand it, I need to point backward one sibling topic and forward one sibling topic and detect the end cases where there is no forward/backward sibling. I am stumped. Would someone mind helping me with the XPath construct(s) to do this? Regards, Randy XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








