RE: [xsl] cdata output and different xslt processors

Subject: RE: [xsl] cdata output and different xslt processors
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Mon, 29 Oct 2001 06:04:41 -0800
Hi,

Let me try again. I want this to be parsed by the browser to display a
dropdown menu to the browser-user (the result of a server-side
transformation - other things not showing in this snippet needing the
transform):

<HTML XMLNS:myMenu>
<?IMPORT namespace="myMenu" implementation="/js/menu.htc"/>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<DIV STYLE="position:absolute; padding:5px; background:menu; border:2px
outset #cccccc;">
   <myMenu:menu id="Site" onsubmenu_click="doFunction()" >Site
      <myMenu:menu id="mnItem_GenSite">Generate Site</myMenu:menu>
      <myMenu:menu id="mnItem_PromoteSite">Promote Site</myMenu:menu>
    	<myMenu:menu id="mnItem_EditProps_Site">Properties</myMenu:menu>
      <myMenu:menu id="mnItem_SiteMap">View Sitemap</myMenu:menu>
      <myMenu:menu id="mnItem_New_Site">Edit Another Site</myMenu:menu>
   </myMenu:menu>
</DIV>
</BODY>
</HTML>
-----------------------------------------
I had been wrapping it like so:

<![CDATA[<HTML XMLNS:myMenu>
<?IMPORT namespace="myMenu" implementation="/js/menu.htc"/>]]>

and

<![CDATA[<DIV STYLE="position:absolute; padding:5px; background:menu;
border:2px outset #cccccc;">
   <myMenu:menu id="Site" onsubmenu_click="doFunction()" >Site
      <myMenu:menu id="mnItem_GenSite">Generate Site</myMenu:menu>
      <myMenu:menu id="mnItem_PromoteSite">Promote Site</myMenu:menu>
    	<myMenu:menu id="mnItem_EditProps_Site">Properties</myMenu:menu>
      <myMenu:menu id="mnItem_SiteMap">View Sitemap</myMenu:menu>
      <myMenu:menu id="mnItem_New_Site">Edit Another Site</myMenu:menu>
   </myMenu:menu>
</DIV>]]>
--------------------
IS there a way to do this without CDATA and xsl:text?

The reason it has to do namespaces is because what would happen if I had
something like this directly below? I get a namespace error of course:

<xsl:template name="menu">
   <DIV STYLE="position:absolute; padding:5px; background:menu; border:2px
outset #cccccc;">
   <myMenu:menu id="Site" onsubmenu_click="doFunction()" >Site
      <myMenu:menu id="mnItem_GenSite">Generate Site</myMenu:menu>
      <myMenu:menu id="mnItem_PromoteSite">Promote Site</myMenu:menu>
    	<myMenu:menu id="mnItem_EditProps_Site">Properties</myMenu:menu>
      <myMenu:menu id="mnItem_SiteMap">View Sitemap</myMenu:menu>
      <myMenu:menu id="mnItem_New_Site">Edit Another Site</myMenu:menu>
   </myMenu:menu>
   </DIV>
</xsl:template>
-----------------------------
If I assign a namespace for the server-side transformation, like so:

<xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:myMenu="http://blah.com/EasyToUseMenu";>

<xsl:template name="menu">
   <DIV STYLE="position:absolute; padding:5px; background:menu; border:2px
outset #cccccc;">
   <myMenu:menu id="Site" onsubmenu_click="doFunction()" >Site
      <myMenu:menu id="mnItem_GenSite">Generate Site</myMenu:menu>
      <myMenu:menu id="mnItem_PromoteSite">Promote Site</myMenu:menu>
    	<myMenu:menu id="mnItem_EditProps_Site">Properties</myMenu:menu>
      <myMenu:menu id="mnItem_SiteMap">View Sitemap</myMenu:menu>
      <myMenu:menu id="mnItem_New_Site">Edit Another Site</myMenu:menu>
   </myMenu:menu>
   </DIV>
</xsl:template>
--------------------
my output to the browser is:
<DIV STYLE="position:absolute; padding:5px; background:menu; border:2px
outset #cccccc;">
   <menu id="Site" onsubmenu_click="doFunction()" >Site
      <menu id="mnItem_GenSite">Generate Site</myMenu:menu>
      <menu id="mnItem_PromoteSite">Promote Site</myMenu:menu>
    	<menu id="mnItem_EditProps_Site">Properties</myMenu:menu>
      <menu id="mnItem_SiteMap">View Sitemap</myMenu:menu>
      <menu id="mnItem_New_Site">Edit Another Site</myMenu:menu>
   </menu>
   </DIV>
------------------

With the output as shown direclty above the code will not work in the
browser. Does this make the problem clear?

thanks for the help,
-Rob


thanks,
-Rob


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
> Sent: Monday, October 29, 2001 1:08 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] cdata output and different xslt processors
>
>
> > I have been porting my presentation layer to use different backend
> > processors.  So far using saxon-java has been the easiest
> > except for it's
> > handling of cdata.  I was wondering if the was a standard way
> > of handling
> > it, specifically "<" and ">"?
>
> yes, there is a standard way of handling it, and Saxon follows
> the standard.
>
> I'm afraid your example doesn't make it clear how you are trying to use
> CDATA, so I can't really see where your misunderstanding lies.
> >
> > My understanding is that whatever is between cdata brackets
> > should be passed
> > "as-is". Wouldn't this be easiest for people to understand?
> > I realize there
> > must be some reason for Saxon not doing this.
>
> Saxon does indeed pass the contents of the CDATA section to the
> application
> "as-is".
>
> >
> > Is there another way I can handle this?  I don't want to declare the
> > namespace for the transformation on the server. I want it to
> > be used only on the client.
>
> I'm afraid that final comment has me completely bemused. What has this got
> to do with namespaces, or with the place where transformation happens?
>
> Mike Kay
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread