You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by El...@tminus10.com on 2000/08/22 23:41:40 UTC

for Paul! Re: id() not working in Cocoon 1.7.2/1.7.4

Hello Paul,

Here is what I sent out a few weeks ago.    Hope to hear from you soon.
Thanks.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

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

*********** 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: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>
  </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 the above line with a string, e.g. "Listing", then it
shows the link -->
       </xsl:element>
    </li>

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





                                                                                                                           
                    Paul_Dick@lot                                                                                          
                    us.com               To:     xalan-dev@xml.apache.org                                                  
                                         cc:                                                                               
                    08/22/2000           Subject:     Re: id() not working in Cocoon 1.7.2/1.7.4                           
                    01:55 PM                                                                                               
                    Please                                                                                                 
                    respond to                                                                                             
                    xalan-dev                                                                                              
                                                                                                                           
                                                                                                                           




Eliza writes:
> 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?

Could you please provide some sample files that illustrate the problem
you've
been having.  There have been some edge-case bugs with id() that we've
been working on.

Paul