You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andreas Look <al...@justis.de> on 2000/08/31 20:51:47 UTC

id() works only on command line

Hello 
Like many others I tried to use the id() function with cocoon. 
When I use Xalan on comand line all works fine and I get a 
result where the contents are in the right regions.
I do this by typing:
java org.apache.xalan.xslt.Process -in page1.xml -xsl page1.xsl -out
page1.html
But if I use cocoon to get the resulkt in a browser it seems
that the id()-functi0on does not work and I get empty <DIV>s.
Can anybody explain this?

Here is my code (you can ignore most of the attributes):

My DTD:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!ELEMENT page (title?, layout, content)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT layout (region+)>
<!ELEMENT region EMPTY>
<!ELEMENT content (paragraph+)>
<!ELEMENT paragraph (#PCDATA)>

<!ATTLIST layout
        id     ID    #REQUIRED
>
<!ATTLIST content
        id     ID    #REQUIRED
>
<!ATTLIST region
        id        ID    #REQUIRED
        contentid IDREF #REQUIRED
        number CDATA #REQUIRED
	content (image | text) #REQUIRED
	x CDATA #REQUIRED
	y CDATA #REQUIRED
	width CDATA #IMPLIED
	height CDATA #IMPLIED
>
<!ATTLIST paragraph
        id       ID    #REQUIRED
        regionid IDREF #REQUIRED
        number   CDATA #REQUIRED
>

and my XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE page SYSTEM "page1.dtd">
<?xml-stylesheet href="page1.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!-- Written by Lars Feistner -->
<page>
  <title>Hello</title>
  <layout id="layout1">
    <region id="reg1" content="text" height="100" number="1"
contentid="par1" width="200"
      x="30" y="40"/>
    <region id="reg2" content="text" height="100" number="2"
contentid="par2" width="80"
      x="250" y="80"/>
  </layout>
  <content id="content1">
    <paragraph id="par1" number="1" regionid="reg1"><text>first
region</text><kack>noch so'n scheiss</kack></paragraph>
    <paragraph id="par2" number="2" regionid="reg2"><text>second
region</text></paragraph>
  </content>
</page>

and finally a snip of my XSL:

<xsl:template match="layout">
	
  <xsl:for-each select="region"> 
    <div style="position:absolute; top:{@y}px; left:{@x};
background-color:#C0C0C0">	

		<xsl:value-of select="id(@contentid)/text"/>

    </div>
  </xsl:for-each>
</xsl:template>

Thanks in advance

-- 
Dipl.-Ing. (FH) Andreas Look
Tel : +49(0)711-820507-30   	Just Innovative Software GmbH
Fax : +49(0)711-820507-79       Heimsheimer Strasse 1                
E-Mail : alook@justis.de       	D-70499 Stuttgart