xsl-list
[Top] [All Lists]

RE: How to put space between two characters?

2004-04-08 09:58:17
Thanks for the reply Ken but I tried your way and it
gives me the error 'The stylesheet does not contain a
document element. The stylesheet may be empty, or it
may not be a well-formed XML document'

Here is my code.I just added those three lines given
by you but by adding thode lines,code doesn't seems to
work.In case u've trouble seeing the code,I've
attached it as an attachment.

<?xml version='1.0' encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:xlink="http://www.w3.org/1999/xlink";>
<xsl:output omit-xml-declaration="yes" indent="yes" />



<xsl:key name="data" match="GrantNet" use="NameOfForm"
/>

<xsl:template match="/">
  <xsl:apply-templates/>
</xsl:template>


<xsl:template match="dataroot">

<HTML>
<HEAD>
  <TITLE>External Agency Forms</TITLE>
</HEAD>
<BODY>


<A NAME="TOP"/> 
<p align="left"><font color="#004080" face="Times New
Roman"><B><big><big>FORMS</big></big></B></font></p>

<p align="left"><font color="#004080" face="Times New
Roman">

<xsl:for-each
select="//GrantNet[generate-id(.)=generate-id(key('data',NameOfForm))]">
<xsl:sort select="NameOfForm" order="ascending"/>
<a
href="#{generate-id(NameOfForm)}"><big><xsl:value-of
select="NameOfForm"/> </big></a><br/>
</xsl:for-each>

</font></p><hr/>




<xsl:for-each
select="//GrantNet[generate-id(.)=generate-id(key('data',NameOfForm))]">

<xsl:sort select="NameOfForm" order="ascending"/><br/>

<B><strong><font color="#000080"><big><big>
<a name="{generate-id(NameOfForm)}">


<xsl:value-of select="NameOfForm"/> 
</a></big></big></font></strong></B>


<xsl:for-each
select="key('data',NameOfForm)"><xsl:text> </xsl:text>
    <xsl:text>  </xsl:text>

<a href="{From_ORSP_Server}">< img alt="NewPDF.gif"
border="0" height="25" src="NewPDF.gif"
width="25"/></a> <xsl:text>  </xsl:text><xsl:text> 
</xsl:text> <xsl:text>  </xsl:text>  

<a href="{From_Granting_Agency}"><img alt="NewPDF.gif"
border="0" height="25" src="NewPDF.gif"
width="25"/></a> <br/>

<br/><big>Description:</big> <xsl:value-of
select="Description"/><br/><br/><hr/>



</xsl:for-each>


</xsl:for-each>
<p><center><a href="#TOP"><img alt="top.gif"
border="0" height="31" src="top.gif"
width="81"/></a></center></p>

</BODY>
</HTML>

</xsl:template>

</xsl:stylesheet>

Thanks for help.
Regards,
Puja



--- "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
wrote:
At 2004-04-06 07:23 -0700, puja thakral wrote:
But how can I add
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " "> <!--known for HTML output,
not in XML-->
]>
to my stylesheet?

Just as I showed you ... but I note that you (or my
mailer?) corrupted the 
middle line and removed the numeric character
reference.

Do I've to make a seperate doctype?

What is a "separate doctype"?

I'm sorry but I'm getting a little confused.

I'm sorry I wasn't more clear.

My stylesheet is:

<?xml version='1.0' encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:xlink="http://www.w3.org/1999/xlink";>

Then change it to:

<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " "> <!--known for HTML output,
not in XML-->
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:xlink="http://www.w3.org/1999/xlink";>

Just add the three lines I gave you ... this is an
XML issue, not an XSLT 
issue.

<xsl:template match="dataroot">

Unfortunately, your naked HTML got corrupted by my
mail client, so I can't 
see what you have in the template rule.

I want to add space between the images so they're
at least a little apart.

The following will place a non-breaking space
between a bunch of children 
image elements (provided you add at the top the
three lines I gave you) ... 
I'm only guessing at the names of your elements and
attributes, but you'll 
get the picture (no pun intended!):

<xsl:for-each select="image">
   <xsl:if test="position()>1"> </xsl:if>
   <img src="{(_at_)filename}"/>
</xsl:for-each>

I hope this helps.

.................. Ken

--
Public courses: Spring 2004 world tour of hands-on
XSL instruction
Each week:   Monday-Wednesday: XSLT/XPath;
Thursday-Friday: XSL-FO
Hong Kong May 17-21; Bremen Germany May 24-28;
Helsinki June 14-18

World-wide on-site corporate, govt. & user group
XML/XSL training.
G. Ken Holman                
mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.         
http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   
+1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness 
http://www.CraneSoftwrights.com/s/bc



__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/