constructing a URI in IE5 syntax (was RE: concat)

Subject: constructing a URI in IE5 syntax (was RE: concat)
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Mon, 9 Aug 1999 11:39:33 -0600
> I use <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
> xmlns="http://www.w3.org/TR/REC-html40"; result-ns=""> as XSL 
> processor.

> IE5 tell me that I can't use xsl:text.

Right, my mistake. It's not important.
I was just using xsl:text to make the code look nice.

> If I change my xsl processor,  I think that the template I
> did will not work again. 

The IE5 XSL processor is a buggy implementation of the Dec 1998 XSL draft,
but it is your only option right now for client-side processing. I would
strongly suggest updating your code to work with the July 9 XSLT and XPath
drafts, and using the standalone version of XT for testing, because sooner
or later you must unlearn the bad habits you have acquired in trying to make
your code work with IE5. That is just my opinion, though.

I wrote:
> > <A href="http://pc_merle/servlets/param?{$foo}";>
> >         <xsl:value-of select="$bar"/>
> > </A>
> >
> > Replace $foo with an XPath that will match phlo.xml, and
> > replace $bar with an XPath that will match GLOSSAIRE.

You asked (again):
> I try to get the value of VdkVgwKey just after param? but I obtain
> nothing. what is the syntax??
> <xsl:template match="CHAMP[(@NAME='VdkVgwKey')]">
>  <A href="http://pc_merle/servlets/param?{text()/}">
>     <xsl:value-of select="../CHAMP[(@NAME='TITRE')]"/>
>  </A>
> </xsl:template>

First make sure that 'TITRE' is 'Titre' if that is what is in your XML.
Next, note that the {...} syntax I showed above will not work with IE5. I
didn't realize this at the time that I posted. Sorry. The second example I
gave should be rewritten as follows. The xsl:attribute should be all on 1
line. I verified that this works in IE5:

	<xsl:template match="CHAMP[@NAME='VdkVgwKey']">
	   <A>
	      <xsl:attribute
name="href">http://pc_merle/servlets/param?<xsl:value-of
select="."/></xsl:attribute>
	      <xsl:value-of select="../CHAMP[@NAME='Titre']"/>
	   </A>
	</xsl:template>

I also asked:
> > Are the ()'s necessary in your paths?

My testing indicates that they are not, so you do not need to write
"CHAMP[(@NAME='Titre')]". 

> > > The other problem is if I put at the beginnig: <xsl:stylesheet
> > > xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>, all the xml
> > > which was
> > > printed on my screen dissapear !!!

This is because IE5 recognizes http://www.w3.org/TR/WD-xsl"; as the namespace
of elements that are to be interpreted according to the rules defined in the
XSL 1998-12-16 working draft. IE5 does not recognize any other namespaces
for that purpose.


Here is the XML I tested with (no DTD needed, apparently):

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="s.xsl"?>
<mydoc>
	<CHAMP NAME="Titre">GLOSSAIRE</CHAMP>
	<CHAMP NAME="VdkVgwKey">phlo.xml</CHAMP>
</mydoc>


And here is the XSL (s.xsl) (watch out for line wrap):

<?xml version="1.0"?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/TR/WD-xsl";
	xmlns="http://www.w3.org/TR/REC-html40";
	result-ns="">

	<!-- IE5 forgets to use these default rules assumed by the XSLT spec
-->
	<xsl:template>
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="text()">
		<xsl:value-of/>
	</xsl:template>

	<!-- our templates -->	
	<xsl:template match="CHAMP[@NAME='VdkVgwKey']">
		<A>
			<xsl:attribute
name="href">http://pc_merle/servlets/param?<xsl:value-of
select="."/></xsl:attribute>
			<xsl:value-of select="../CHAMP[@NAME='Titre']"/>
		</A>
	</xsl:template>

	<xsl:template match="CHAMP[@NAME='Titre']">
		<!-- do nothing -->
	</xsl:template>
</xsl:stylesheet>

Good luck,
-Mike


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


Current Thread