RE: [xsl] document function support needed

Subject: RE: [xsl] document function support needed
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 24 Sep 2003 17:35:36 +0100
I can't tell what you're doing wrong. Your stylesheet looks perfectly
OK, but it is obviously solving a different problem from the one you
want to solve. Without seeing your source documents and desired output,
I can't tell you any more.

Michael Kay

> -----Original Message-----
> From: Halgurt Mustafa Ali [mailto:halgurt@xxxxxx] 
> Sent: 24 September 2003 09:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: mhk@xxxxxxxxx
> Subject: RE: [xsl] document function support needed
> 
> 
> Hello,
> 
> Ok I explain it in a bit more, here ist my stylesheet:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <xsl:stylesheet version="1.0"
> 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>                 
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
>                 xmlns:ut="http://description.org/schema/user-type";
>                 xmlns:serv="http://description.org/schema/services";>
> 
> 	<xsl:param name="ID">default</xsl:param>
>                 <xsl:param name="profile"><xsl:value-of
> select="$ID/>.xml</xsl:value-of>
>                 <xsl:variable name="root" select="/"/>
> <xsl:template match="/">
> 
> ...
> ..."some rules opertion on my source document"
> ...
> <xsl:variable name="value" 
> select="document($profile)/user/type/text()"/>
> <xsl:if test="$value='yes'"><xsl:call-template 
> name="Component1"/></xsl:if>
> <xsl:call-template name="Component2"/>
> </xsl:template>
> <xsl:template name="Component1">
> .
> .
> .
> </xsl:template>
> <xsl:template name="Component2">
> .
> .
> .
> </xsl:template>
> </xsl:stylesheet>
> 
> My Source document called VCP-Services.xml, I want to check 
> if the has a
> certain type, then I want to present a component specified 
> for this kind of
> users. Can you please help and tell ma what am I doing wrong? 
> And what ist the
> best way to do that.
> 
> regards,
> Halgurrt
> 
> 
> 
> > Date: Tue, 23 Sep 2003 16:14:08 +0100
> > From: "Michael Kay" <mhk@xxxxxxxxx>
> > Subject: RE: [xsl] document function support needed
> > 
> > > In my template I created a variable value to 
> > > save the value of the desired node, but as soon as I crate 
> > > the variable:
> > > 
> > > <xsl:variable name="value" 
> > > select="document($profile)/user/type/text()"/>
> > > 
> > > I can not use the source document any more, am I defining the 
> > > variable in a wrong way? Please help, it is really urgent.
> > 
> > I suspect you are doing something like
> > 
> > <xsl:for-each select="$value">
> > 
> > in which case, inside the <xsl:for-each>, the current node 
> is in the new
> > document, which means that any //x expressions also refer to the new
> > document.
> > 
> > The usual remedy is to declare a global variable
> > 
> > <xsl:variable name="root" select="/"/>
> > 
> > and then you can always refer to the primary document as $root.
> > 
> > Michael Kay
> > 
> > 
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> > 
> 
> -- 
> NEU FÜR ALLE 
> - GMX MediaCenter - für Fotos, Musik, Dateien...
> Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
> 
> Jetzt kostenlos anmelden unter http://www.gmx.net
> 
> +++ GMX - die erste Adresse für Mail, Message, More! +++
> 


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


Current Thread