[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL-List Digest V3 #891
XSL-List Digest Friday, July 6 2001 Volume 03 : Number 891 In this issue: RE: document() question Re: RE: building a nodeset from selected nodes RE: RE: building a nodeset from selected nodes RE: building a nodeset from selected nodes RE: How to sort a nodeset referenced by a variable? RE: building a nodeset from selected nodes Re: fo:table-header RE: RE: A simple solution (Was: Re: One for tomorrow :-) ) embedding XML in the value of attribute Re: embedding XML in the value of attribute RE: building a nodeset from selected nodes RE: embedding XML in the value of attribute RE: Re: RE: Re: XPath riddle Re: embedding XML in the value of attribute Adding Line Feed Character to the output. RE: Adding Line Feed Character to the output. RE: accumulator needed ---------------------------------------------------------------------- Date: Thu, 5 Jul 2001 18:36:31 +0100 From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Subject: RE: document() question I think you're doing the best that's possible within the constraints of the XSLT and JAXP specifications. If you're worried about magic constants, return <x:dummy xmlns:x="........"/> using a namespace URI based on a domain name that you control. That's considered respectable as a magic constant in the XML world. Mike Kay Software AG > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Joerg > Pietschmann > Sent: 05 July 2001 17:45 > To: XSL List > Subject: document() question > > > Hello all > > The spec for the document() function states: > "If there is an error retrieving the ressource, then the XSLT > processor > may signal an error; if it does not signal an error, it must recover > by returning an empty node set." > So far, so good. > I want to write a style sheet which retrieves some data from external > documents, however, i don't want the processor to signal an > error if the > ressource can not be found. Instead, i want to handle this in > the style > sheet. I tried to supply a somewhat twisted URIResolver to > the processor > (Saxon 6.3), but it seems i have to feed it some valid XML. I was > successful using a StringReader("<dummy/>"). This raises two problems: > - I have to test for two error conditions: document() may > return a node > set with the "dummy" element node in case the ressource was > not found, > and i have also to test for an empty node set in case something else > went wrong (for processors which don't raise errors). > - It violates the design principle of not to use magic constants. > > Question(s): Is there a way to write an URIResolver so that document() > will return an empty node set in some specific cases? > Is there a better, portable way to silence a processor about missing > ressources in invocations of the document() function? (Note: a "File > exists" extension function is not (yet) portable and in any > case subject > to subtle failures due to race conditions.) Or for some other error > conditions for that matter, like ressources not containing > well formed XML, > or missing external DTDs. > > Last Note: The XSLT 2.0 usage of document() for multiple > output has even > more failure modes than the applications for reading. This will become > *really* interesting. > > Regards > > J.Pietschmann > -- > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 11:36:13 -0700 (PDT) From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Subject: Re: RE: building a nodeset from selected nodes Hall, Kurt wrote: > Thanks, but doesn't the instruction: > <xsl:for-each select="key('columns-by-name', column)"> > get a node-set of columns where name=column? I need an instruction that can get a node-set of columns where name IN (col1, col2, ...). > > Re: using an apply-templates: I don't think I can use it as a way to > generate my node-list which can then be passed to a call-template. > The problem I see is that if I separate the node-set generation > from my transformation of that node set, I've got to use a variable > to connect the two (which I can't do because I don't have access to > the nodeset() extension). Hi Kurt, Wendel gave you the key to the exact solution to your problem. You don't understand it at present and this means that you need to read a good book on XSLT -- I'd recommend Mike Kay's "XSLT Programmer's Reference". Otherwise the only way to show to you that Wendel's solution is correct, would be to write the complete code of the stylesheet so that when you apply it to your xml source you'll have to agree with the fact that it produces exactly the desired output. But of course, this would not be useful to you at all -- you need to be gettting some experience -- therefore read more and try to write XSLT code. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail <A HREF="http://personal.mail.yahoo.com/" TARGET="_new"><FONT COLOR="BLUE">http://personal.mail.yahoo.com/</FONT></A> XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 12:53:23 -0600 From: "Hall, Kurt" <khall@xxxxxxxxxxx> Subject: RE: RE: building a nodeset from selected nodes Hmmm. I have the Kay book, and I've written over 3000 lines of xsl, so those aren't the only requirements :-), but I confess to not using the key() function before. My misreading of the original response and the Kay book was that the second parameter to the key() function was a single value, not a node-set as is now obviously possible. Thanks, - -kurt - -----Original Message----- From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx] Sent: Thursday, July 05, 2001 12:36 PM To: khall@xxxxxxxxxxx Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: RE: building a nodeset from selected nodes Hall, Kurt wrote: > Thanks, but doesn't the instruction: > <xsl:for-each select="key('columns-by-name', column)"> > get a node-set of columns where name=column? I need an instruction that can get a node-set of columns where name IN (col1, col2, ...). > > Re: using an apply-templates: I don't think I can use it as a way to > generate my node-list which can then be passed to a call-template. > The problem I see is that if I separate the node-set generation > from my transformation of that node set, I've got to use a variable > to connect the two (which I can't do because I don't have access to > the nodeset() extension). Hi Kurt, Wendel gave you the key to the exact solution to your problem. You don't understand it at present and this means that you need to read a good book on XSLT -- I'd recommend Mike Kay's "XSLT Programmer's Reference". Otherwise the only way to show to you that Wendel's solution is correct, would be to write the complete code of the stylesheet so that when you apply it to your xml source you'll have to agree with the fact that it produces exactly the desired output. But of course, this would not be useful to you at all -- you need to be gettting some experience -- therefore read more and try to write XSLT code. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail <A HREF="http://personal.mail.yahoo.com/" TARGET="_new"><FONT COLOR="BLUE">http://personal.mail.yahoo.com/</FONT></A> XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 05 Jul 2001 15:51:43 +0100 From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Subject: RE: building a nodeset from selected nodes Hi Kurt, At 05:26 PM 7/5/01, you wrote: >Thanks, but doesn't the instruction: > <xsl:for-each select="key('columns-by-name', column)"> >get a node-set of columns where name=column? I need an instruction >that can get a node-set of columns where name IN (col1, col2, ...). I see you've picked up the nice feature that that second argument can return a node-set and not be treated as a string. (Even if it didn't, you could still iterate over the column children and use . for that second argument. ;-) But as I said, we use keys so much for grouping, we forget the general case of what they're really for, "a way to work with documents that contain an implicit cross-reference structure" [XSLT 12]. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 - ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 05 Jul 2001 15:53:35 +0100 From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Subject: RE: How to sort a nodeset referenced by a variable? At 05:40 PM 7/5/01, Mike wrote: > > So <xsl:sort select="secondelement" /> would work as well (and be a > > teeny-tiny bit faster). > >It might save two microseconds in parsing the XPath expression, but I think >you can take it as read that any respectable XSLT engine will reduce xxx and >./xxx to the same internal representation. Actually I think ./xxx is quite >nice for extra clarity. Cool. So I guess the standards for respectability are going up! :-) - --Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 - ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 14:23:06 -0600 From: "Hall, Kurt" <khall@xxxxxxxxxxx> Subject: RE: building a nodeset from selected nodes Hi Wendell, Using key() is sooooo much easier than recursive templates. At Thursday, July 05, 2001 8:52 AM, you wrote: > (Even if it didn't, you could still iterate over the column children and > use . for that second argument. ;-) I originally thought of doing this (assuming I understand you) but then I got back to the problem where I have multiple node-sets with no obvious (to me?) way to combine them into a single node-set, though I was eventually able to combine them using recursive template calls. Is there a simpler approach to combine a variable number of node-sets into a single node-set (without using extensions)? Thanks again, - -kurt - -----Original Message----- From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] Sent: Thursday, July 05, 2001 8:52 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: building a nodeset from selected nodes Hi Kurt, At 05:26 PM 7/5/01, you wrote: >Thanks, but doesn't the instruction: > <xsl:for-each select="key('columns-by-name', column)"> >get a node-set of columns where name=column? I need an instruction >that can get a node-set of columns where name IN (col1, col2, ...). I see you've picked up the nice feature that that second argument can return a node-set and not be treated as a string. (Even if it didn't, you could still iterate over the column children and use . for that second argument. ;-) But as I said, we use keys so much for grouping, we forget the general case of what they're really for, "a way to work with documents that contain an implicit cross-reference structure" [XSLT 12]. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 - ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 20:57:36 +0100 From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Subject: Re: fo:table-header Hi Ram, > In my style sheet I am using <fo:table-header> to create a header > for a table and it has 5 cloums.. each column differs in width but > when i create the header.. with five columns I am getting fixed > length column header and my data is getting overlapped.. across the > columns Just having a quick look at the XSL-FO Rec, it seems to me that the fo:table-column elements should be the first children of your fo:table, whereas you're putting them *after* the fo:table-header. I think that FOP should probably raise an error since that's invalid XSL-FO, but perhaps the problems you're experiencing stem from it using some kind of event-based processing of the XSL-FO and moving the fo:table-column elements up before the fo:table-header will alleviate your problem. Cheers, Jeni - --- Jeni Tennison <A HREF="http://www.jenitennison.com/" TARGET="_new"><FONT COLOR="BLUE">http://www.jenitennison.com/</FONT></A> XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Fri, 6 Jul 2001 07:53:38 +1000 From: "Tim Watts" <timw@xxxxxxx> Subject: RE: RE: A simple solution (Was: Re: One for tomorrow :-) ) Daniel, one of the purposes of XML and XSLT is to seperate the content from the way it is displayed. To use depreciated font elements sort of defeats the way mark-up has been designed. And check again on font support in Netscape. Font-family and font-size are fully supported in Netscape 4.x and above, and many additional features are available which font tags can't support. [Core CSS, Schengil-Roberts, 2000] Even properties which have a "partial" rating - ie font-style, are classed so because of some small variation from the spec. (oblique should be available as well as italic in the case of font-style - but show me the font tag for oblique ;) ) Happy coding, Tim Watts - -----Original Message----- From: Daniel Newman Sent: Wednesday, 4 July 2001 9:21 PM And I just love those font tags. I even use upper case HTML tags!!! hah hah. If I removed my font tags, I'd have to use that terribly unreliable css :-) There are users out there still using Netscape you know. Daniel - -----Original Message----- From: David Carlisle Sent: 04 July 2001 11:56 (by the way are you sure you really want to polute your generated HTML with all those <font> elements, they are deprecated in HTML4 and XHTML) David XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 18:00:47 -0400 From: "B. Tommie Usdin" <btusdin@xxxxxxxxxxxxxxxx> Subject: embedding XML in the value of attribute >From: Larry_Mason@xxxxxx >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >Subject: embedding XML in the value of attribute >Date: Thu, 5 Jul 2001 15:00:42 -0500 >I am trying to define a syntax that works in JSP and XSLT where I compute >the class for a tag given various conditions. The following syntax works >in a JSP page using a custom tag for formclass. > <input type="text" class="<larry:formclass/>"/> > >I have a similar XSLT template for formclass. However, processing the >syntax above in my XML feed complains about the < preceding the namespace. > If I change it to > <input type="text" class="<larry:formclass/>"/> >everything works fine. > >I would prefer identical syntax if possible [ note: the first syntax must >remain for the JSP to work properly ]. Any thoughts? > >If I can't "fix" it, I think I will suggest this syntax and recommend >escaping the embeded less-than and greater-than symbols. > <input type="text" class="<larry:formclass/>"/> > >Cheers! >Larry - -- ====================================================================== B. Tommie Usdin mailto:btusdin@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> 17 West Jefferson Street Phone: 301/315-9631 Suite 207 Direct Line: 301/315-9634 Rockville, MD 20850 Fax: 301/315-8285 - ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 23:13:53 +0100 From: David Carlisle <davidc@xxxxxxxxx> Subject: Re: embedding XML in the value of attribute >in a JSP page using a custom tag for formclass. > <input type="text" class="<larry:formclass/>"/> > That's not XML so can't work in any XML language (such as XSLT) I seem to recall JSP does have an alternative syntax that is XML? The XSLT syntax that most closely corresponds to this is an attribute value template eg <input type="text" class="{larry:formclass}"/> or <input type="text" class="{$larry:formclass}"/> or whatever other XPath expression you require inside {} David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit <A HREF="http://www.star.net.uk/stats.asp" TARGET="_new"><FONT COLOR="BLUE">http://www.star.net.uk/stats.asp</FONT></A> or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 05 Jul 2001 17:18:27 +0100 From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Subject: RE: building a nodeset from selected nodes At 09:23 PM 7/5/01, Kurt wrote: >Hi Wendell, > >Using key() is sooooo much easier than recursive templates. > >At Thursday, July 05, 2001 8:52 AM, you wrote: > > (Even if it didn't, you could still iterate over the column children and > > use . for that second argument. ;-) > >I originally thought of doing this (assuming I understand you) but >then I got back to the problem where I have multiple node-sets with >no obvious (to me?) way to combine them into a single node-set, though >I was eventually able to combine them using recursive template calls. Well, that's effectively what key() is doing. What I was describing above is merely that we could say <xsl:for-each select="column"> <xsl:apply-templates select="key('columns-by-name', .)"/> </xsl:for-each> and be calling the function multiple times with the current column node's string value as the second argument each time. But since we can do the same thing by putting the node-set itself into the second argument, this is unnecessary. You also ask: >Is there a simpler approach to combine a variable number of node-sets >into a single node-set (without using extensions)? Well, now we know how to do it with keys, it's easier to see how you could engineer your way back *out* of using them: so in your example, you could be doing <xsl:template match="query"> <xsl:variable name="matching-columns" select="//table/column[name=current()/column]"/> <xsl:for-each select="$matching-columns"> ... </xsl:for-each> </xsl:template> and be binding the nodes into a variable that way. (This location path works because of the rule of what makes node-sets equal: that the string value of one of the nodes in the first node set equals the string value of one of the nodes in the other. Such a loose rule is useful sometimes.) But even this is expensive compared to using keys, except maybe on small documents. It's really the key() function that's saving us all the work. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 - ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Fri, 6 Jul 2001 00:06:44 +0100 From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Subject: RE: embedding XML in the value of attribute It's a fundamental (and useful) feature of XSLT that a stylesheet is a well-formed XML document. In other words, no way! Mike Kay Software AG > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of B. Tommie > Usdin > Sent: 05 July 2001 23:01 > To: xsl-list > Subject: embedding XML in the value of attribute > > > > >From: Larry_Mason@xxxxxx > >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >Subject: embedding XML in the value of attribute > >Date: Thu, 5 Jul 2001 15:00:42 -0500 > > >I am trying to define a syntax that works in JSP and XSLT > where I compute > >the class for a tag given various conditions. The following > syntax works > >in a JSP page using a custom tag for formclass. > > <input type="text" class="<larry:formclass/>"/> > > > >I have a similar XSLT template for formclass. However, > processing the > >syntax above in my XML feed complains about the < preceding > the namespace. > > If I change it to > > <input type="text" class="<larry:formclass/>"/> > >everything works fine. > > > >I would prefer identical syntax if possible [ note: the > first syntax must > >remain for the JSP to work properly ]. Any thoughts? > > > >If I can't "fix" it, I think I will suggest this syntax and recommend > >escaping the embeded less-than and greater-than symbols. > > <input type="text" class="<larry:formclass/>"/> > > > >Cheers! > >Larry > > -- > ====================================================================== > B. Tommie Usdin mailto:btusdin@xxxxxxxxxxxxxxxx > Mulberry Technologies, Inc. > <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> > 17 West Jefferson Street Phone: 301/315-9631 > Suite 207 Direct Line: 301/315-9634 > Rockville, MD 20850 Fax: 301/315-8285 > ---------------------------------------------------------------------- > Mulberry Technologies: A Consultancy Specializing in SGML > and XML > ====================================================================== > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Fri, 6 Jul 2001 02:20:31 +0300 From: "Nikolaos Giannadakis" <ngiann@xxxxxxxxxx> Subject: RE: Re: RE: Re: XPath riddle hi all, with this schema <xsd:schema xmlns:xsd=" <A HREF="http://www.w3.org/2001/XMLSchema"" TARGET="_new"><FONT COLOR="BLUE">http://www.w3.org/2001/XMLSchema"</FONT></A> elementFormDefault="qualified"> <xsd:element name="C"> <xsd:complexType> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element name="V" type="B"/> <xsd:element name="W" type="A"/> </xsd:choice> </xsd:complexType> </xsd:element> <xsd:complexType name="B"> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <xsd:element name="E" type="A"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="A"> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> <!-- RRR is causing confusion --> <xsd:element name="RRR"> <xsd:complexType> <xsd:sequence> <xsd:element name="V"> <xsd:complexType> <xsd:choice> <xsd:element name="E"/> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="D" type="B"/> </xsd:sequence> </xsd:complexType> </xsd:schema> how would you select all Es of type A? Stating explicitly that RRR may not appear in the wanted Es ancestors would not do (I guess), because that would mean that partly identical paths should be identified beforehand etc. A possible XML instance could be this: <C> <W> <RRR> <D> <E> bar </E> </D> </RRR> <D> <E> <RRR> <D> <E> foo </E> </D> </RRR> <D> <E/> </D> </E> </D> </W> </C> regards, nikolas/ XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 16:26:50 -0700 From: "Kurt Cagle" <cagle@xxxxxxxxx> Subject: Re: embedding XML in the value of attribute Seconding Michael's comments on this -- The JSP syntax is not XML, even though it bears a passing resemblance to it. If you are using JSP in this fashion - to pass the results of a Java class to an output stream, however, it may be worth your while to recast the whole page as an XML document processed by an XSLT document with an appropriate handler for the tag: Your XML source document may then look like: <html> <head>...</head> <body> <form .. target="_new"> .... <larry:formclass id="myinput" xmlns:larry="urn:schemas-larry-com:formclass"/> </body> </html> Your XSLT transformation may look like: <xsl:stylesheet xmlns:xsl=" <A HREF="http://www.w3.org/1999/XSL/Transform"" TARGET="_new"><FONT COLOR="BLUE">http://www.w3.org/1999/XSL/Transform"</FONT></A> xmlns:larry="urn:schemas-larry-com:formclass"> <!-- scripts language="Java" src="larry.formclass" implements-prefix="larry"/> <xsl:template match="/"> <xsl:apply-templates select="*|@*|text()"/> </xsl:template> <xsl:template match="*|@*|text()"> <xsl:apply-templates select="*|@*|text()"/> </xsl:template> <xsl:template match="larry:formclass> <input type="text" name="{@id}" value="{larry:getInput()}"/> </xsl:template> </xsl:template> The advantage to this approach is that you can also pass parameters to the input type via attributes, something that is more problematic using JSP. Take a look at Michael's superb book for more information on using extension functions. - -- Kurt Cagle - ----- Original Message ----- From: "Michael Kay" <mhkay@xxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, July 05, 2001 4:06 PM Subject: RE: embedding XML in the value of attribute > It's a fundamental (and useful) feature of XSLT that a stylesheet is a > well-formed XML document. In other words, no way! > > Mike Kay > Software AG > > > -----Original Message----- > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of B. Tommie > > Usdin > > Sent: 05 July 2001 23:01 > > To: xsl-list > > Subject: embedding XML in the value of attribute > > > > > > > > >From: Larry_Mason@xxxxxx > > >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > >Subject: embedding XML in the value of attribute > > >Date: Thu, 5 Jul 2001 15:00:42 -0500 > > > > >I am trying to define a syntax that works in JSP and XSLT > > where I compute > > >the class for a tag given various conditions. The following > > syntax works > > >in a JSP page using a custom tag for formclass. > > > <input type="text" class="<larry:formclass/>"/> > > > > > >I have a similar XSLT template for formclass. However, > > processing the > > >syntax above in my XML feed complains about the < preceding > > the namespace. > > > If I change it to > > > <input type="text" class="<larry:formclass/>"/> > > >everything works fine. > > > > > >I would prefer identical syntax if possible [ note: the > > first syntax must > > >remain for the JSP to work properly ]. Any thoughts? > > > > > >If I can't "fix" it, I think I will suggest this syntax and recommend > > >escaping the embeded less-than and greater-than symbols. > > > <input type="text" class="<larry:formclass/>"/> > > > > > >Cheers! > > >Larry > > > > -- > > ====================================================================== > > B. Tommie Usdin mailto:btusdin@xxxxxxxxxxxxxxxx > > Mulberry Technologies, Inc. > > <A HREF="http://www.mulberrytech.com" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com</FONT></A> > > 17 West Jefferson Street Phone: 301/315-9631 > > Suite 207 Direct Line: 301/315-9634 > > Rockville, MD 20850 Fax: 301/315-8285 > > ---------------------------------------------------------------------- > > Mulberry Technologies: A Consultancy Specializing in SGML > > and XML > > ====================================================================== > > > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> > > > > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 17:08:56 -0700 From: "Avula, Raj" <RAvula@xxxxxxxxxxx> Subject: Adding Line Feed Character to the output. Hi, I am writing XSL to convert XML to TEXT format. I need to add Line Feed Characters(LF, Control-J, Ascii 10) to the final output to indicate end of line. Any body have idea, on how to insert Line feed characters in the ouput text. Thank & Regards, Raj. XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Thu, 5 Jul 2001 17:26:46 -0700 From: "Avula, Raj" <RAvula@xxxxxxxxxxx> Subject: RE: Adding Line Feed Character to the output. Never mind. I got it. <xsl:text> </xsl:text> Thanks, Raj > -----Original Message----- > From: Avula, Raj > Sent: Thursday, July 05, 2001 5:09 PM > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: Adding Line Feed Character to the output. > > > Hi, > I am writing XSL to convert XML to TEXT format. > I need to add Line Feed Characters(LF, Control-J, Ascii 10) > to the final output to indicate end of line. > Any body have idea, on how to insert Line feed characters > in the ouput text. > > Thank & Regards, > Raj. > > > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> > XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ Date: Fri, 6 Jul 2001 08:17:03 +0300 From: Jarno.Elovirta@xxxxxxxxx Subject: RE: accumulator needed Hip hei! > <!-- Draw a quarter note. --> > <xsl:template match="note"> You need to declare the parameters used here, i.e. <xsl:param name="x_offset" select="0"> <xsl:param name="y_offset" select="0"> > <xsl:if test="type='quarter'"> > <xsl:element name="g"> > <xsl:attribute name="transform"> > <xsl:text>translate(</xsl:text> > <xsl:value-of select="$x_offset"></xsl:value-of> > <xsl:text>,</xsl:text> > <xsl:value-of select="$y_offset"></xsl:value-of> > <xsl:text>)</xsl:text> > </xsl:attribute> > > <xsl:element name="use"> > <xsl:attribute name="xlink:href" > namespace=" <A HREF="http://www.w3.org/1999/xlink">" TARGET="_new"><FONT COLOR="BLUE">http://www.w3.org/1999/xlink"></FONT></A> > <xsl:text>MusicGlyphs.svg#BLACKHEAD</xsl:text> > </xsl:attribute> > </xsl:element> > </xsl:element> > </xsl:if> > </xsl:template> You could make the accumulator thingy to work by either counting the durations of previous notes with something like sum(preceding-sibling::note/duration) which wouldn't actually accumulate anything, but would get the job done; or, you could process the notes by first selecting only the first one and then in the template for "note" continue by select the following-sibling::note with the offset parameter. Hope this helps, Jarno XSL-List info and archive: <A HREF="http://www.mulberrytech.com/xsl/xsl-list" TARGET="_new"><FONT COLOR="BLUE">http://www.mulberrytech.com/xsl/xsl-list</FONT></A> ------------------------------ End of XSL-List Digest V3 #891 ****************************** -- _______________________________________________ Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free! http://www.net2phone.com/cgi-bin/link.cgi?143 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|