Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Templating TPL (embed perl into XSLT)
Trina
Does anyone know how to embed Perl code into XSLT?
For example: expected result: <a href="home/subdir/welcome.htm">Home</a>
perl code
$link_path = "home/subdir";
xslt code
<xsl:stylesheet>
.......
<a><xsl:attribute name="href">home/subdir(should be shown here)</xsl:attribute>welcome.htm</a>
..........</xsl:stylesheet>
Thanks in advance
Find more posts tagged with
Comments
Migrateduser
See the docs on the <iwov_xslt> PT tag on your teamsite server at
http://localhost/iw/help/tst/PT/TeamSite__PT__iwov_xslt.html
.
bw
Bob Walden [bob.walden@interwoven.com]
Interwoven Education Group
IM: Yahoo, MSN bob_walden
Migrateduser
The iwov_xslt lets you invoke XSLT from Perl (or a TPL).
I think the question was about calling Perl from XSLT. I have not done this before. I think you would have to consult the XSLT spec. See the section on "Extension Functions".
Brinko Kobrin
Interwoven Staff Engineer
Migrateduser
Yes, I guess my answer was a bit opaque. To be more clear, if you use <iwov_xslt> in a PT, you can stull use <iw_perl> too.
Also, bear in mind that the TPL can itself be an XSL stylesheet. Thus you could embed <iw_perl> tags into the PT, which, when compiled, would emit a finished XSL file.
bw
Bob Walden [bob.walden@interwoven.com]
Interwoven Education Group
IM: Yahoo, MSN bob_walden
Trina
I did look through the /tst/help topic but no such sample (of what I would like to do).
What I am trying to do is to produce a html page contains list of links - by picking up the .xml and rendering with stylesheet. The problem occurs when user select Preview on the DCT because the Preview page temporary created at the root level, whereas all my href links linking to the sub-directory.
The 3 pages I have created as follows:
in abc.tpl
<iw_perl>
<![CDATA[
my $link_path = "home/subdir"; # this value is not static...
my $xmlfile = "myrec.xml";
my $param = iwpt_get_flag_param('-oprefix');
my $xsltfile;
if ($param ne "") # Preview page or Generate?
{
$xsltfile = "somepath/dothis.xsl";
} else {
$xsltfile = "somepath/dothat.xsl";
}
]]></iw_perl>
<iwov_xslt xsl_file="$xsltfile">
<iw_include file="$file_list"/>
</iwov_xslt>
file myrec.xml
<collections>
<col>
<title>blah blah blah</title>
<link>welcome.htm</title>
</col>
</collections>
file preview.xsl
This page must be able to pick up $link_path in .tpl above and embeded as shown...
<xsl:stylesheet>
.......
<a><xsl:attribute name="href">home/subdir/<xsl:value-of select="link"/></xsl:attribute><xsl:value-of select="title"/></a>
..........</xsl:stylesheet>
Any suggestions are very much appreciated. :-)
Adam Stoller
Generic off-the-top-o-my-head thoughts...
1) What version of TeamSite / TeamSite Templating?
2) What platform?
3) I didn't really *read* your code - (sorry) - but are the links all relative to your docroot?
4) ... and is your branch laid out, structurally, like it would be on the production server?
I believe that pre-5.0 or perhaps pre-5.5[?] versions of TeamSite's iwproxy required a certain proxy setting in the iw.cfg file to render previews - after 5.0 (5.5?) this proxy setting was no longer needed and, in fact, tended to cause problems.
Check your iw.cfg to see what kinds of proxy setting(s) you have - perhaps post an *attachement* with the iw.cfg (and perhaps include in the attachment a sample DCR and PT that are causing problems) - using attachments makes it easier for others to read/review.
--fish
(Interwoven, Curriculum Development)