cocoon-dev mailing list archives

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

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
displayed!!!!!

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


************ 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"?>
<!DOCTYPE JUNK SYSTEM "junk.dtd">
<JUNK>
  <Company ID="C0000">
    <Name>Microsoft Corp.</Name>
    <Info>Info on Microsoft.....</Info>
  </Company>
  <Vendor Company="C0000"/>
</JUNK>


*********** junk.xsl file*****************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
                 xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">

  <xsl:output method="html"/>

  <xsl:template match="/">

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

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


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

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

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

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

<!--       Listing  -->

       </xsl:element>
    </li>

</xsl:template>

</xsl:stylesheet>





Mime
View raw message