[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem with id(@attrib)

Subject: Problem with id(@attrib)
From: John_Velonis@xxxxxxxxxxxx
Date: Thu, 18 Mar 1999 12:27:41 -0500
attrib not working


Hi all,

I'm trying to convert the following XML to HTML using XSL:

<?xml version="1.0"?>

<vendors>

  <org name="Organization 1">
     <builds product="p1"/>
     <builds product="p2"/>
  </org>

  <org name="Organization 2">
    <builds product="p3"/>
  </org>

  <product id="p1" name="Product1">
  </product>

  <product id="p2" name="Product2">
  </product>

  <product id="p3" name="Product3">
  </product>

</vendors>

Here's my XSL stylesheet.  I'm new to XSL, so it may be kind of klunky,
but according to the spec it looks like it should work:

<?xml version="1.0"?>

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/TR/WD-xsl"
  xmlns="http://www.w3.org/TR/REC-html40"
  result-ns="">

  <xsl:id attribute="id"/>

  <xsl:template match="vendors">
    <HTML>
      <BODY>
        <H1>Organizations</H1>
        <xsl:apply-templates select="org"/>
        <HR/><H1>Products</H1>
        <xsl:apply-templates select="product"/>
      </BODY>
    </HTML>
  </xsl:template>

  <xsl:template match="org">
    <HR/><H2><xsl:value-of select="@name"/></H2>
    <xsl:if test="builds"><H3>Products</H3><UL>
      <xsl:apply-templates select="builds"/></UL></xsl:if>
  </xsl:template>

  <xsl:template match="builds">
    <LI><A HREF="#{@product}"><xsl:value-of
select="//id(@product)/@name"/></A></LI>
  </xsl:template>

  <xsl:template match="product">
    <HR/><H2><A NAME="#{@id}"><xsl:value-of select="@name"/></A></H2>
  </xsl:template>

</xsl:stylesheet>

The problem I'm having is with the "//id(@product)/@name" selection in the
"builds"
template.  LotusXSL returns nothing for this:
   <A HREF="#p1"></A>
XSL:P does better, but it includes all three products, not just the one with the
specified id:
   <A HREF="#p1">Product1Product2Product3</A>

Is this valid usage?  Is there some other way to do this?  It seems like a
simple
task, but I haven't seen this exact situation in any examples.

John Velonis
Hyperion Solutions



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.