By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,136 Members | 2,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,136 IT Pros & Developers. It's quick & easy.

When is XSLT not appropriate?

P: n/a
ted
Was wondering if XSLT alone is appropriate for the following situation.

From XML, I'm creating a small website (around 50 pages) with pages that
link to each other through a nav menu and a "crumb-trail" of links. I'm
transforming the XML with XSLT through Saxon.

The nav menu and "crumb-trail" show the user where they are within the site
and is made by reflecting the XML tree structure.

My problem now is that when I want to generate a page that references
information that lies in another context in the XML (referenced with an
IDREF), I go into that other context to get it. But this makes my nav menu
and "crumb trail" reflect that other context - not the one the user is
currently in (the one where the IDREF is). I can't figure out how to get
around this.

Would using Java and XSLT be more appropriate for jobs like this?

TIA,
Ted


Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 27 Aug 2003 10:09:13 GMT, "ted" <te************@yahoo.com>
wrote:
Was wondering if XSLT alone is appropriate for the following situation.
Yes.
From XML, I'm creating a small website (around 50 pages) with pages that
link to each other through a nav menu and a "crumb-trail" of links.


I did this a few years back. As I don't reckon much to XML's IDREF for
representing graph structures, I used RDF instead.

To handle the "context switching", I used a good many variables, most
of which were passed as parameters to named templates.

For the breadcrumb trail itself, I just used an axis of
ancestor-or-self::

<!-- Breadcrumb trails -->

<xslt:template name="breadcrumbs" >
<xslt:param name="Application" select="/.." />
<!-- Display a "breadcrumb" trail (as described by Nielsen) to show
where the Application is in the overall hierarchy -->

<div id="divBreadcrumbs" >
<xslt:for-each
select="$Application/ancestor-or-self::*[substring-after(@rdf:type,
'#')='Application']" >
<xslt:if test="position()!=1" > -&gt; </xslt:if>
<span class="application" ><xslt:choose>
<xslt:when test="m:menu-item" >
<xslt:call-template name="menu-item-as-nav-link" >
<xslt:with-param name="menu-item" select="m:menu-item" />
</xslt:call-template>
</xslt:when>
<xslt:otherwise><xslt:value-of select="./@rdf:ID"
/></xslt:otherwise>
</xslt:choose></span>
</xslt:for-each>
</div>
</xslt:template>

Jul 20 '05 #2

P: n/a
ted
I'm using a lot of named template and variables. Stopped working with XSL
for a couple of months. Came back and it took me a while to figure out what
I originally wrote. Probably bad code (and commenting), but was wondering
if larger jobs are better served using XSLT in conjuction with Java. I find
myself wanting to put things in arrays and hashes sometimes. But maybe it's
because I don't know my XSL well enough.

"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:q6********************************@4ax.com...
On Wed, 27 Aug 2003 10:09:13 GMT, "ted" <te************@yahoo.com>
wrote:
Was wondering if XSLT alone is appropriate for the following situation.


Yes.
From XML, I'm creating a small website (around 50 pages) with pages that
link to each other through a nav menu and a "crumb-trail" of links.


I did this a few years back. As I don't reckon much to XML's IDREF for
representing graph structures, I used RDF instead.

To handle the "context switching", I used a good many variables, most
of which were passed as parameters to named templates.

For the breadcrumb trail itself, I just used an axis of
ancestor-or-self::

<!-- Breadcrumb trails -->

<xslt:template name="breadcrumbs" >
<xslt:param name="Application" select="/.." />
<!-- Display a "breadcrumb" trail (as described by Nielsen) to show
where the Application is in the overall hierarchy -->

<div id="divBreadcrumbs" >
<xslt:for-each
select="$Application/ancestor-or-self::*[substring-after(@rdf:type,
'#')='Application']" >
<xslt:if test="position()!=1" > -&gt; </xslt:if>
<span class="application" ><xslt:choose>
<xslt:when test="m:menu-item" >
<xslt:call-template name="menu-item-as-nav-link" >
<xslt:with-param name="menu-item" select="m:menu-item" />
</xslt:call-template>
</xslt:when>
<xslt:otherwise><xslt:value-of select="./@rdf:ID"
/></xslt:otherwise>
</xslt:choose></span>
</xslt:for-each>
</div>
</xslt:template>

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.