Subject: Re: [xsl] Counting nodes - now specifying body in stylesheet From: "Mike Leahy" <mgleahy@xxxxxxxxxxxxxxxx> Date: Wed, 3 Jul 2002 09:19:20 -0400 |
Thank you all for your suggestions - I'm definitely planning to move all my work to XSLT at some point. Américo, I tried adding the xsl:output tag in the beginning of the xsl document, and that solved the table width problem. I'm still left with one small detail; when I use the following body tag: <body bgcolor="#bbbbbb" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" rightmargin="0" margin="0"> I'm still left with whitespace below the table - do you get this as well? Is there a way to get the <body> properties to apply to the entire page like in a normal HTML file? Mike ----- Original Message ----- From: "Américo Albuquerque (E-mail)" <aalbuquerque@xxxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, July 03, 2002 5:52 AM Subject: RE: [xsl] Counting nodes - now specifying body in stylesheet > Hi Mike. > > I tested your code in IE6 and in N6.2.3 > The problem you got only apper in N6. If you add to your code the > <xsl:output method="html"/> tag it works as you wanted to. > > your code will be something like: > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="html"/> > ... > > hope that this help > Américo > > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mike Leahy > Sent: Tuesday, July 02, 2002 8:39 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] Counting nodes - now specifying body in stylesheet > > > My apologies, after testing the first example again, the xsl commands do > work - however when I use the sample code below (which is more like the > actual code I'm using), my table ends up being a mile wide once I add the > body element. All the information is there, but it is appearing off-screen > (I never noticed this before). This doesn't happen without the body > element. I removed the "width" attribute from the tables, and that > eliminated the problem, but now my tables are too small. I guess the > percentage is not recognized properly. > > Last, when I specify the body attributes (e.g. using a background image or > color), the body only applies to the immediate area around the text/tables, > not the entire document. So the result is a small area with a background, > and whitespace for the rest of the page. Is there a solution for that? > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:template match="/"> > <HTML> > <body bgcolor="#bbbbbb"> > <TABLE cellpadding="2" width="96%" bordercolor="#000000" cellspacing="2"> > <TR> > <xsl:for-each select="metadata/idinfo/citation/citeinfo/onlink"> > <B><font face="Arial"><a><xsl:attribute name="href"><xsl:value-of > select="."/></xsl:attribute>View Map</a></font></B> > <xsl:if test="(position() != last())"><br/> > </xsl:if> > </xsl:for-each><br/> > </TR> > <TR> > <TD COLSPAN="2" BORDER="2" align="right"><font color="#00000" > face="Arial, Helvetica, sans-serif" size="3"><B><xsl:value-of > select="metadata/idinfo/citation/citeinfo/title"/> - <xsl:value-of > select="metadata/idinfo/natvform"/></B></font></TD> > </TR> > </TABLE> > <TABLE width="100%" BORDER="2" cellpadding="2" bordercolor="#000000"> > <TR> > <TD HEIGHT="30" VALIGN="bottom" bgcolor="#FFFFFF" bordercolor="#000000" > cellpadding="2"> <font face="Arial, Helvetica, sans-serif" size="2"><A > NAME="ident" > href="/computing/services/spatialdata/documentation/fesmetadatastd_rev3.htm# > 1a">1</A></font></TD> > <TD COLSPAN="2" align="center"><font color="#000000" face="Arial, > Helvetica, sans-serif" size="2"><B>IDENTIFICATION > INFORMATION</B></font></TD> > </TR> > <TR> > <TD ROWSPAN="4"><font face="Arial, Helvetica, sans-serif" size="2"><a > href="/computing/services/spatialdata/documentation/fesmetadatastd_rev3.htm# > 1a">1.1</a></font></TD> > <TD COLSPAN="2" align="center" bgcolor="#cccccc"><font color="#000000" > face="Arial, Helvetica, sans-serif" size="2"><b>Citation</b></font></TD> > </TR> > <TR> > <TD bgcolor="#f5f5f5"><font face="Arial, Helvetica, sans-serif" > size="2"><b><font color="#000000">Originator</font></b></font></TD> > <TD bgcolor="#f5f5f5"><font color="#000000" face="Arial, Helvetica, > sans-serif" size="2"><xsl:value-of > select="metadata/idinfo/citation/citeinfo/origin"/></font></TD> > </TR> > </TABLE> > </body> > </HTML> > </xsl:template> > </xsl:stylesheet> > > I'm viewing the XML document through Netscape 6.02 - I don't know what > processor it is using. How can I find out? > > Here is a sample of what my XML code would look like: > > <?xml version="1.0"?> > <?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?> > <DEFANGED_metadata xml:lang="en"> > <idinfo> > <citation> > <citeinfo> > <onlink>Online Link URL 1</onlink> > <onlink>Online Link URL 2 (and so on)</onlink> > <origin>Originiator name</origin> > </citeinfo> > </citation> > </idinfo> > </metadata> > > Thanks for your help, > Mike > > ----- Original Message ----- > From: "Wendell Piez" <wapiez@xxxxxxxxxxxxxxxx> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Tuesday, July 02, 2002 11:49 AM > Subject: Re: [xsl] Counting nodes - now specifying body in stylesheet > > > > Mike, > > > > Definitely switch to XSLT. The sooner you switch, the more grief you'll > > save yourself. > > > > At 11:12 AM 7/2/2002, you wrote: > > >Regarding the namespace I am using, one of the reasons I have not moved > to > > >the newer namespace is that I cannot seem to make an output stylesheet > look > > >very nice using the http://www.w3.org/1999/XSL/Transform namespace. > > > > > >Perhaps, someone could give me suggestions with this problem: > > > > > >The biggest issue I have is when I try to define the body of the > stylesheet. > > >In the example below, I have a couple simple xsl commands, and I've > defined > > >a body with a background color. > > > > > >Normally, I would get a list of all the > > >"metadata/idinfo/citation/citeinfo/onlink" elements, followed by the > > >"metadata/idinfo/citation/citeinfo/origin" element. However, once I have > > >entered the "<body>" tag, every xsl command following the for-each > command > > >end up blank - the "metadata/idinfo/citation/citeinfo/origin" will not > > >appear in the result, and I get no processing errors. If the "<body>" > tag > > >and it's closing tag "</body>" are removed from the code below, then > > >everything works fine, but I'm stuck with unformatted results. > > > > Honestly, this is baffling. Please test very carefully (using the same > > XPath expressions in your for-each select) to confirm that it's the > > presence or absence of the <body> node that makes the difference. There's > > no way in XSLT it should; it does not change the context for the > evaluation > > of any expressions. > > > > Which processor are you using? > > > > >I've tried looking at formatting objects in XSL, but haven't been able to > > >get anything to work yet. > > > > If you're targetting web display, write XSLT that creates HTML (for now). > > At present FOs are still being used mainly to generate print output (e.g. > > in PDF). > > > > ><?xml version="1.0"?> > > ><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > >version="1.0"> > > ><xsl:template match="/"> > > ><HTML> > > ><body bgcolor="#cccccc"> > > > > > ><xsl:for-each select="metadata/idinfo/citation/citeinfo/onlink"> > > > > If you're not getting your values reported, it's probably because this > > XPath returns no nodes. Does your source look more or less like > > > > <?xml version="1.0"?> > > <DEFANGED_metadata> > > <idinfo> > > <citation> > > <citeinfo> > > <onlink>Here's the value you want</onlink> > > </citeinfo> > > </citation> > > </idinfo> > > </metadata> > > > > <DEFANGED_metadata> being your document ("root") element? If not, your > XPath won't > > work. (If you post a snippet of your source, it's easy enough to see what > > XPath you need.) > > > > > <xsl:value-of select="." /> > > > <xsl:if test="current()[(position() != last())]"> > > > > This should be (position() != last()) > > The test as given is never true (since the position of a node is always > > last when it's the only node selected). > > > > > <br/> > > > </xsl:if> > > ></xsl:for-each> > > > > > ><xsl:value-of select="metadata/idinfo/citation/citeinfo/origin"/> > > > > > ></body> > > ></HTML> > > ></xsl:template> > > ></xsl:stylesheet> > > > > From the design of this stylesheet, it also looks like you might want to > > do a bit of homework on templates. You don't really need them for this > > simple application, but you will. > > > > Cheers, > > Wendell > > > > > > > > ====================================================================== > > Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx > > Mulberry Technologies, Inc. http://www.mulberrytech.com > > 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: http://www.mulberrytech.com/xsl/xsl-list > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Counting nodes - now spec, Américo Albuquerque | Thread | RE: [xsl] Counting nodes - now spec, Américo Albuquerque |
Re: [xsl] encoding issues, David Carlisle | Date | Re: [xsl] xsl-fo question, patrick andries |
Month |