When is XSLT not appropriate?

Discussion in 'XML' started by ted, Aug 27, 2003.

  1. ted

    ted Guest

    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
     
    ted, Aug 27, 2003
    #1
    1. Advertising

  2. ted

    Andy Dingley Guest

    On Wed, 27 Aug 2003 10:09:13 GMT, "ted" <>
    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:eek:therwise><xslt:value-of select="./@rdf:ID"
    /></xslt:eek:therwise>
    </xslt:choose></span>
    </xslt:for-each>
    </div>
    </xslt:template>
     
    Andy Dingley, Aug 27, 2003
    #2
    1. Advertising

  3. ted

    ted Guest

    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" <> wrote in message
    news:...
    > On Wed, 27 Aug 2003 10:09:13 GMT, "ted" <>
    > 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:eek:therwise><xslt:value-of select="./@rdf:ID"
    > /></xslt:eek:therwise>
    > </xslt:choose></span>
    > </xslt:for-each>
    > </div>
    > </xslt:template>
    >
    >
    >
     
    ted, Aug 28, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Dob
    Replies:
    0
    Views:
    10,439
    Rob Dob
    Nov 27, 2005
  2. Roy
    Replies:
    1
    Views:
    329
    bruce barker \(sqlwork.com\)
    Apr 20, 2006
  3. Jeff Kish
    Replies:
    1
    Views:
    383
    Tjerk Wolterink
    Oct 30, 2004
  4. Amol
    Replies:
    2
    Views:
    293
  5. Synapse Syndrome

    Liquid Layouts not always appropriate ?

    Synapse Syndrome, Jan 21, 2008, in forum: HTML
    Replies:
    81
    Views:
    1,834
    Travis Newbury
    Jan 25, 2008
Loading...

Share This Page