467,182 Members | 1,044 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,182 developers. It's quick & easy.

When is XSLT not appropriate?

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
  • viewed: 3643
Share:
2 Replies
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
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.

Similar topics

1 post views Thread by Jeff Kish | last post: by
4 posts views Thread by MGG | last post: by
3 posts views Thread by Jack Fox | last post: by
5 posts views Thread by RicercatoreSbadato | last post: by
2 posts views Thread by super todd | last post: by
9 posts views Thread by daph4ntom | last post: by
3 posts views Thread by Carles Company Soler | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.