cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject HELP! id() not working in Cocoon 1.7.2/1.7.4
Date Fri, 25 Aug 2000 17:52:33 GMT

A few weeks ago I posted a message to Cocoon users DL regarding id()
problem.  I have not got much response on this.  I have also posted it to
Xalan and Xerces DLs and it seems like the problem is in Cocoon or a
combination of Xalan/Xerces in Cocoon environment.

Is this a known problem?  Any suggestion/help is greatly appreciated.

Below is the details.

I am using Cocoon 1.7.2 as well as 1.7.4 and the id() doesn't seem to be
working when I use it in my stylesheet to display the link or reference
name.  Has anyone run into this problem?  If so, any workaround?

Below are my DTD, XML, and XSL files.  Basically, I have 2 elements named
"Company" and "Vendor".  The "Vendor" element is pointing to "Company"
element.  In my XSL file, when I use the id() in Vendor match template to
print company name, it prints nothing.  If I insert a hard-coded string, it
works (see below ******** in my XSL file).  So, I know the link is working.
It's just that I can't get the name

*********** junk.dtd file**********************
<!ELEMENT JUNK (Company, Vendor)>
<!ELEMENT Company (Name, Info)>
<!ATTLIST Company
<!ENTITY % companyref "Company IDREF #REQUIRED">
<!ATTLIST Vendor

************ junk.xml file **************
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="junk.xsl" type="text/xsl"?>
<?xml-stylesheet href="junk.xsl" type="text/xsl" media="netscape"?>
<?xml-stylesheet href="junk.xsl" type="text/xsl" media="explorer4"?>
<?cocoon-process type="xslt"?>
  <Company ID="C0000">
    <Name>Microsoft Corp.</Name>
    <Info>Info on Microsoft.....</Info>
  <Vendor Company="C0000"/>

*********** junk.xsl file*****************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet  xmlns:xsp=""

  <xsl:output method="html"/>

  <xsl:template match="/">

    <xsl:processing-instruction name="cocoon-format">type="text/html"</

        <title>some title</title>
      <body link="#0000ff" vlink="#800080">
      <xsl:apply-templates select="JUNK"/>

<xsl:template match="JUNK">
   <xsl:apply-templates select="Company"/>  <br/>
   <xsl:apply-templates select="Vendor"/>

<xsl:template match="Company">
     <xsl:text>Name: </xsl:text>
     <xsl:element name="a">
     <xsl:attribute name="name"> <xsl:value-of select="@ID"/>
     <xsl:value-of select="Name"/>
     <xsl:if test="URL">
         <xsl:text>URL: </xsl:text>
     <xsl:value-of select="URL"/>  <br/>
     <xsl:text>Info: </xsl:text>
     <xsl:value-of select="Info"/> <br/> <br/>

<xsl:template match="Vendor">
       <xsl:element name="a">
           <xsl:attribute name="href">
               #<xsl:value-of select="@Company"/>

<!--  ****** A BUG!!!!! id() doesn't work, so put a hard-coded string
instead  -->
       <xsl:value-of select="id(@Company)/Name"/>

<!--       Listing  -->




View raw message