Subject: RE: [xsl] document function support needed From: "Michael Kay" <mhk@xxxxxxxxx> Date: Sat, 27 Sep 2003 00:09:16 +0100 |
Well, the first obvious thing is that this expression: <xsl:variable name="value" > select="document($profile)/user/type/text()"/> isn't going to find anything in the user Profile you've shown us, because the <user> element doesn't have a child called <type>. Also, this code must have got garbled somewhere: > > <xsl:param name="profile"><xsl:value-of > > select="$ID/>.xml</xsl:value-of> (there's a missing closing quote, and <xsl:value-of> instructions must be empty. It looks to me as if you posted code that you never put through an XSLT processor.) Michael Kay > -----Original Message----- > From: Halgurt Mustafa Ali [mailto:halgurt@xxxxxx] > Sent: 26 September 2003 22:01 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Cc: mhk@xxxxxxxxx > Subject: RE: [xsl] document function support needed > > > Hello, > > Ok, here are my source documents(Parts of them): > > 1.a sample user Profile: > > <?xml version="1.0" > ?> > > <user><userdata><ID>?</ID><usertype><tourist>yes</tourist><bus > inessman>no</businessman> ??..</usertype></userdata></user> > > 2.the document to be transformed: > > <?xml version="1.0" ?> > > - <rdf:RDF 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"> > > - <rdf:Description ID="vcp-services" city="munich"> > > - <serv:component> > > - <rdf:Description ID="museum"> > > <rdf:type href="munich/cityinformation/museums" /> > > - <ut:user> > > <rdf:tourist >yes</rdf:tourist> > <rdf:businessman>no</rdf:businessman> > > </ut:user> > > <rdf:image href="munich/images/stgeorg_ausgeschnitten.jpg" /> > > <ut:description>museums and galleries, Historical sights - > technical sights - history and art. A selection of museums > and collections in Munich.</ut:description> > > </rdf:Description> > > </serv:component> > > - <serv:component> > > - <rdf:Description ID="hotels"> > > <rdf:type href="munich/cityinformation/hotels" /> > > - <ut:user> > > <rdf:tourist >yes</rdf:tourist> > <rdf:businessman>yes</rdf:businessman> > > </ut:user> > <ut:description>A list of munichs best Hotels.</ut:description> > > </rdf:Description> > > </serv:component> > > - <serv:component> > > - <rdf:Description ID="parking"> > > <rdf:type href="munich/cityinformation/parking" /> > > - <ut:user> > > <rdf:tourist >yes</rdf:tourist> > <rdf:businessman>yes</rdf:businessman> /> > > </ut:user> > > <ut:description>Parking psobilities in and around > munich.</ut:description> > > > </rdf:Description> > > </serv:component> > > </rdf:Description> > > </rdf:RDF> > > > > > according to the usertype in the user profile I want to > filter the components and give the rest in html back. > > Many thanks, > Halgurt > > > > ----- Original Message ----- > From: "Michael Kay" <mhk@xxxxxxxxx> > To: "'Halgurt Mustafa Ali'" <halgurt@xxxxxx>; > <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Wednesday, September 24, 2003 6:35 PM > Subject: RE: [xsl] document function support needed > > > 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 file://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! +++ > > > > -- > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] document function support, Halgurt Mustafa Ali | Thread | RE: [xsl] document function support, Halgurt Mustafa Ali |
RE: [xsl] Parameters query, Michael Kay | Date | [xsl] Re: Re: Re: recursive help, Dimitre Novatchev |
Month |