You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Emmanuelle Gauthier <eg...@montrouge.tt.slb.com> on 2001/05/16 10:17:11 UTC

DSML in LDAP taglib with WAP device


 >How could you *not* declare the DSML namespace, if you intend to use DSML and
 >WML in the same document? You can only default one of them (WML, in the above
 >snippet).
 >
 >--Jeff

I do not intend to use DSML and WML in the same document! I use DSML in a 
generated XML document (by the LDAP taglib with DSML format) and in the XSL 
style sheet which must recognize the dsml tags. But after that the style 
sheet is applied, I don't have dsml tags anymore in my WML document, and I 
don't want to. If I manually remove the DSML namespace definition from the 
<wml> root tag of my generated WML document, I obtain the wanted result 
with my WAP device. So I suppose that the DSML namespace definition is not 
needed in the WML document! My question is: why is the dsml definition 
automatically written in the end of process document (HTML or WML) whereas 
it is just needed in the style sheet?

Emmanuelle Gauthier

PS: I send you all my documents (XML, XSL style sheet, and WML result) 
maybe you will better understand with that.

my XML document:
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-logicsheet href="/WEB-INF/ldap.xsl"?>
<?cocoon-format type="text/xml"?>

<xsp:page language="java"
xmlns:ldap="http://www.apache.org/2000/LDAP"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:request="http://www.apache.org/1999/XSP/Request"
 >
<page>
         <xsp:pi target="xml-stylesheet"
         >href="dsml-html.xsl" type="text/xsl" media="netscape"</xsp:pi>

         <xsp:pi target="xml-stylesheet"
         >href="ldap3.xsl" type="text/xsl" media="explorer"</xsp:pi>

         <xsp:pi target="xml-stylesheet"
         >href="dsml-wml.xsl" type="text/xsl" media="wap"</xsp:pi>

         <xsp:pi target="xml-stylesheet"
         >href="dsml-vxml.xsl" type="text/xsl" media="voicexml"</xsp:pi>

         <ldap:execute-query>
                 <ldap:server-url>ldap://ldap2.slb.com:389/o=slb,c=an</ldap:server-url>
                 <ldap:query>(&amp;(|(cn=<request:get-parameter name="name" 
default="gauthier"/>)(cn=* <request:get-parameter name="name" 
default="gauthier"/>)(cn=* <request:get-parameter name="name" 
default="gauthier"/> *)(cn=<request:get-parameter name="name" 
default="gauthier"/> *)))</ldap:query>

                 <ldap:scope>sub</ldap:scope>
                 <ldap:deref-link>true</ldap:deref-link>
                 <ldap:count-limit>10</ldap:count-limit>
                 <ldap:attributes>telephonenumber,cn,sn,givenname,mail</ldap:attributes>
                 <ldap:time-limit>0</ldap:time-limit>
                 <ldap:relative-dn>true</ldap:relative-dn>

                 <ldap:result-format><request:get-parameter name="format" 
default="dsml"/></ldap:result-format>

                 <ldap:doc-element>ldapsearch</ldap:doc-element>
                 <ldap:entry-element>searchresult</ldap:entry-element>
                 <ldap:id-attribute>ID</ldap:id-attribute>
                 <ldap:error-element>error</ldap:error-element>

</ldap:execute-query>
</page>
</xsp:page>

my stylesheet for WAP device (with the declaration of dsml namespace!)
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Stylesheet to format DSML to WML.
$Revision: 1.0 $ $Date: 2001/04/25 11:51:29 $
-->
<xsl:stylesheet 
version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                 xmlns:dsml="http://www.dsml.org/DSML">
         <xsl:template match="dsml:dsml/dsml:directory-entries">
                 <xsl:processing-instruction 
name="cocoon-format">type="text/wml"</xsl:processing-instruction>
                 <wml>
                         <template>
                                 <do type="prev" label="retour">
                                         <prev/>
                                 </do>
                         </template>
                         <xsl:if test="count(dsml:entry)=0">
                                 <card id="no_reponse" title ="LDAP results">
                                         <p>aucune reponse a la demande 
faite !</p>
                                 </card>
                         </xsl:if>
                         <xsl:apply-templates />
                 </wml>
         </xsl:template>
         <xsl:template match="dsml:entry">
                 <card>
                         <xsl:attribute name="id">c<xsl:value-of 
select="position()"/></xsl:attribute>
                         <xsl:attribute name="title">LDAP 
results</xsl:attribute>
                         <p>
                                 <xsl:value-of 
select="position()"/>/<xsl:value-of select="last()"/>:
                                 <xsl:value-of select="@dn"/><br/>
                                 <xsl:apply-templates select="dsml:attr"/>
                         </p>
                         <do type="accept" label="suivant">
                                 <xsl:choose>
                                         <xsl:when test="position()=last()">
                                                 <go href="#c1"/>
                                         </xsl:when>
                                         <xsl:otherwise>
                                                 <go href="#c{position()+1}"/>
                                         </xsl:otherwise>
                                 </xsl:choose>
                         </do>
                 </card>
         </xsl:template>
         <xsl:template match="dsml:attr">
                 <xsl:value-of select="@name"/><xsl:text>: </xsl:text>
                 <xsl:apply-templates select="dsml:value"/>
         </xsl:template>
         <xsl:template match="dsml:value">
                 <xsl:value-of select="."/><br/>
         </xsl:template>
</xsl:stylesheet>

The return WML document, which fails with the error "Attribute is not declared"
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" 
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml xmlns:dsml="http://www.dsml.org/DSML">
<template>
         <do label="retour" type="prev"><prev/></do>
</template>
<card id="c1" title="LDAP results">
         <p>1/1: cn=Emmanuelle 
Gauthier  210414,ou=student<br/>telephonenumber: 33 1 4746 4301<br/>
                mail: egauthier@montrouge.tt.slb.com<br/>
              givenname: Emmanuelle<br/>sn: Gauthier<br/>
              cn: Emmanuelle Gauthier<br/>Emmanuelle Gauthier  210414<br/>
         </p>
         <do label="suivant" type="accept"><go href="#c1"/></do>
</card>
</wml>
<!-- This page was served in 821 milliseconds by Cocoon 1.8.2 -->



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>