You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by El...@tminus10.com on 2000/08/05 04:53:11 UTC

HELP!!! id() not working on Cocoon??!!!

Hello,

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 XML, DTD, 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.  So, I know the link is working. It's just that I can't get the name
displayed!!!!!  ANY HELP IS GREATLY APPRECIATED!

************ 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: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>JUNK</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:text>Info: </xsl:text>
     <xsl:value-of select="Info"/> <br/> <br/>

</xsl:template>


<xsl:template match="Vendor">
<xsl:text>HIT Vendor, so print the company's info</xsl:text>
<li>
       <xsl:element name="a">
           <xsl:attribute name="href">
               #<xsl:value-of select="@Company"/>
           </xsl:attribute>
       <xsl:value-of select="id(@Company)/Name"/>     <!--  if I replace
this line with a string, e.g. "Listing", then it shows the link -->
       </xsl:element>
    </li>

</xsl:template>
</xsl:stylesheet>

*********** 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;>


Re: HELP!!! id() not working on Cocoon??!!!

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 4 Aug 2000 Eliza.Khosrova@tminus10.com wrote:

> 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?

i saw some reference to a problem with id() that cropped up recently on
the xalan developers list - something to do with xerces changes not
playing well with xalan changes. you may wish to upgrade to the latest
versions of xalan and xerces, and/or post your problem to the xalan
developers list.

you might also give the xt transformer a whirl.

- donald