|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I run a Live News Feed section on http://www.KillSomeTime.com and my left nav, header, and right nav are all server side includes. All my pages are asp except for the news section which is xml transformed with xhtml and xsl. I cant figure out how to use a SSI to include a html snippit inside the xsl document. Is this possible? |
|
||||
|
Is the ssi file an asp file or an html file?
__________________
Daniel M: South West Styles/STEELid daniel@steelid.com http://www.steelid.com http://www.thephototool.com |
|
|||
|
I have the same problem. I have a
ssi snippet such as I'm using the php script: <?php $processor = xslt_create(); $result = xslt_process($processor, 'htdocs/xslt/msc.xml', 'htdocs/xslt/msc.xsl'); if(!$result) echo xslt_error($processor); xslt_free($processor); echo "$result"; ?> this runs and displays my page in the browser fine, but the ssi doesn't pass through the server. can someone please help me too. |
|
|||
|
iumj: is there a reason you don't want to use the PHP include() statement? Most servers probably aren't configured to parse PHP for SSI.
maddhacker24: Your site seems to work, so I'm not sure what problem you're having with this. Short of generating the xsl to include the content you want in there, you can't really do SSI in XSL. You can do an <xsl:include/>, but you'd have to recreate the menu as a template. Why do you want the menus to be in the xsl anyway? |
|
|||
|
thanks for your answer. sorry if i wasn't that clear. my problem is. i run open the php file
in my web browser. the php file takes the xml and xsl below and processes them, and shows me what i need in the web browser. my only problem is, in the msc.xsl the , or if I put <?php include("file.txt"); ?>, doesn't get included by the server. i just get the page i want, with a comment or nothing if i use the php include. i'm wondering if there is a way to use the php script below to process my xml and xsl files, and then after that, process my ssi or php includes. I put samples of my files below. Thanks again, --- msc.php ----------------------------------- <?php $processor = xslt_create(); $result = xslt_process($processor, 'htdocs/msc.xml', 'htdocs/msc.xsl'); if(!$result) echo xslt_error($processor); xslt_free($processor); echo $result; ?> ----------------------------------------------- --- msc.xml ----------------------------------- <msc> <subject key="01" value="something here"> <class key="01A" value="something here"> <topic key="01A35" value="something here"/> </class> </subject> </msc> ----------------------------------------------- --- msc.xsl ----------------------------------- <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="xml" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/> <xsl:template match="msc"> <html> <head> <title></title> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template name="subject" match="subject"> <h2 class="hpadding"> <xsl:value-of select="@key"/> <xsl:text>: </xsl:text> <xsl:value-of select="@value"/> </h2> <xsl:call-template name="class"/> <xsl:apply-templates/> </xsl:template> <xsl:template name="class"> <p class="ppadding"> <xsl:for-each select="class"> <xsl:value-of select="@key"/> <xsl:text>: </xsl:text><span style="color:maroon;"> <xsl:value-of select="@value"/></span> </xsl:for-each> </p> </xsl:template> </xsl:stylesheet> ------------------------------------------------ |
|
|||
|
I can think of a few ways to do that, but neither using SSI.
1. assign the contents of your xsl to a variable, perform a str_replace() on (or whatever marker you choose to include in the xsl file) to replace it with the contents of your file.txt. Perform the xslt with the xsl variable rather than directly using the file. 2. pass the contents of file.txt as the 5th argument in your xslt_process() call so that it is available as a parameter in your xsl file. 3. And probably the simplest: do your transform, them perform the str_replace against $result. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |