Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-31-2004, 05:28 PM
WebProWorld Member
 

Join Date: Feb 2004
Posts: 43
maddhacker24 RepRank 0
Default Using a SSI Include within an XSL document?

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?
Reply With Quote
  #2 (permalink)  
Old 04-05-2004, 06:59 PM
swstyles's Avatar
WebProWorld Pro
 

Join Date: Aug 2003
Location: Phoenix, AZ
Posts: 167
swstyles RepRank 0
Default

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
Reply With Quote
  #3 (permalink)  
Old 04-06-2004, 11:28 AM
WebProWorld Member
 

Join Date: Feb 2004
Posts: 43
maddhacker24 RepRank 0
Default

The include would be a simple html snippit.
Reply With Quote
  #4 (permalink)  
Old 05-25-2004, 12:07 PM
WebProWorld New Member
 

Join Date: May 2004
Location: Indiana University
Posts: 2
iumj RepRank 0
Default trouble running ssi in xsl

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.
__________________
Weldon
Reply With Quote
  #5 (permalink)  
Old 05-25-2004, 02:16 PM
WebProWorld Pro
 

Join Date: Mar 2004
Location: Pittsburgh, PA, USA
Posts: 114
ChrisRC RepRank 0
Default

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?
Reply With Quote
  #6 (permalink)  
Old 05-25-2004, 04:22 PM
WebProWorld New Member
 

Join Date: May 2004
Location: Indiana University
Posts: 2
iumj RepRank 0
Default my question about ssi in xsl again

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>
------------------------------------------------
__________________
Weldon
Reply With Quote
  #7 (permalink)  
Old 05-25-2004, 06:26 PM
WebProWorld Pro
 

Join Date: Mar 2004
Location: Pittsburgh, PA, USA
Posts: 114
ChrisRC RepRank 0
Default

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.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0