I have a HTML document that contains inline OMML. Is it possible to apply XSLT transformations to this inline XML somehow and get back a HTML with MathML? Probably have to use OMML2MML.xsl somehow. After that I could use mathjacx to actually render the equations for display.
<html>
<head>
</head>
<body>
<xml id="sheet1" src="OMML2MML.XSL">
<m:oMath xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<m:sSub>
<m:sSubPr>
<m:ctrlPr>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math"/>
<w:i/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:lang w:val="et-EE"/>
</w:rPr>
</m:ctrlPr>
</m:sSubPr>
<m:e>
<m:r>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:lang w:val="et-EE"/>
</w:rPr>
<m:t>N</m:t>
</m:r>
</m:e>
<m:sub>
<m:r>
<w:rPr>
<w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:lang w:val="et-EE"/>
</w:rPr>
<m:t>3</m:t>
</m:r>
</m:sub>
</m:sSub>
</m:oMath>
</xml>
</body>
</html>
Thanks for any help!
Ok this is what I ended up doing:
Got OMML from Apache POI
Converted that to MathML with javax.xml.transform.Transformer and passing in the OMML2MML.xsl
Removed root node namespace from MathML with plain string manipulation
Directly injected the MathML to HTML
Used mathjax to render the formulas.
Related
I have a multipoint geometry (a single geometry containing multiple points) and I want to place a label on each of the points (the label is always the same). Is it possible to achieve this with SLD? Right now the label is only displayed on a single point.
My SLD looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Multipoint with labels</Name>
<UserStyle>
<Title>Default Point</Title>
<Abstract>A sample style that draws a point</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>rule1</Name>
<Title>Red Square</Title>
<Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>NAME</Label>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
By default the GeoServer label engine goes to a lot of trouble to not label multiple times on the same feature, so this is hard!
I finally managed it using the following (ugly) SLD:
<Rule>
<Title>Capitals</Title>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>0</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
<TextSymbolizer>
<Geometry>
<ogc:Function name="getGeometryN">
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:Function>
</Geometry>
<Label>ID</Label>
</TextSymbolizer>
</Rule>
However this assumes you know how many points there are in your largest multi-point, and that is quite small (otherwise it's a lot of copy & paste).
I had originally hoped to be able to use the vertices function or possibly the labelAllGroup vendor option, but sadly neither worked with multi-points.
i have a problem with ajax form validation. I'm using struts-core 2.3.1.2, struts-jquery-plugin 3.3.0 and struts-json-plugin.
The problem occurs if an ajax form will be submitted by an ajax request and validation fails. Cause then the whole form will be placed on the result element. Therefore you can activate ajax validation on the ajax sumbit button.
http://code.google.com/p/struts2-jquery/wiki/Validation
Here are also outdated information:
http://struts.apache.org/2.2.3.1/docs/ajax-validation.html
But the interceptor "jsonValidationWorkflowStack" is missing in struts-default.xml like written in post: jsonValidationWorkflowStack seems to be removed in Struts 2.3.1
It is sourced out to the struts-json-plugin in struts-plugin.xml. I don't know how i can use this directly but i build my own Stack in struts.xml:
<!-- Sample JSON validation stack -->
<interceptor-stack name="jsonValidationWorkflowStack">
<interceptor-ref name="basicStack"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="jsonValidation"/>
<interceptor-ref name="workflow"/>
</interceptor-stack>
</interceptors>
<action name="updateMySettings" method="execute" class="de.ra.daod.actions.MyAppSettingAction">
<interceptor-ref name="jsonValidationWorkflowStack"/>
<!-- This is not beauty within ajax -->
<result name="input">/WEB-INF/jsp/mysetting_ajax.jsp</result>
<result name="success" type="stream">
<param name="contentType">text/html</param>
<param name="inputName">inputStream</param>
</result>
</action>
And my form looks like:
<s:head />
<sj:head />
<!-- This files are needed for AJAX Validation of XHTML Forms -->
<script src="${pageContext.request.contextPath}/struts/xhtml/validation.js" type="text/javascript"></script>
<s:form id="form" action="private/updateMySettings" theme="xhtml">
<s:textfield id="screenRes" key="appSetting.screenResolution" label="Screen resolution" required="true" />
<s:select key="appSetting.screenDepth" label="Color depth" list="#{'8':'8','16':'16','24':'24'}" required="true" />
<sj:submit value="Update Settings" targets="status" validate="true"/>
</s:form>
Unfortunately i get a javascript error if validation fails or not:
Uncaught TypeError: Object #<Object> has no method 'indexOf'
f.extend.ajax jquery-1.7.1.min.js:4
b.fn.ajaxSubmit
a.struts2_jquery.validateForm jquery.struts2-3.3.0.min.js:18
a.subscribeHandler.h.beforeSubmit jquery.struts2-3.3.0.min.js:18
b.fn.ajaxSubmit
a.subscribeHandler.e jquery.struts2-3.3.0.min.js:18
e.extend.each jquery-1.7.1.min.js:2
a.subscribeHandler.e jquery.struts2-3.3.0.min.js:18
f.event.dispatch jquery-1.7.1.min.js:3
f.event.add.h.handle.i jquery-1.7.1.min.js:3
f.event.trigger jquery-1.7.1.min.js:3
f.fn.extend.trigger jquery-1.7.1.min.js:3
e.extend.each jquery-1.7.1.min.js:2
e.fn.e.each jquery-1.7.1.min.js:2
f.fn.extend.trigger jquery-1.7.1.min.js:3
d.fn.extend.publish jquery.subscribe.min.js:16
e.extend.each jquery-1.7.1.min.js:2
d.fn.extend.publish jquery.subscribe.min.js:16
(anonymous function) jquery.struts2-3.3.0.min.js:18
f.event.dispatch jquery-1.7.1.min.js:3
f.event.add.h.handle.i jquery-1.7.1.min.js:3
It seems that the json object from the response can't be handled and i don't know why cause i followed the old instructions. I assume the cause is the function StrutsUtils.getValidationErrors from struts/utils.js if this function is used with the json object but i'm not sure. Can anyone help ?
I guess stream result and ajax doesn't play well together. just remove the targets
attribute. – jogep
I don't agree with you because the tenor of AJAX isn't load a new page but rather load pieces of whatever to the current page that is why i use an AJAX submit button. To notice the user of the action without reloading the page itself. The workaround is to clear the content of the status div element with javascript. I think that can be automated in struts2-jquery-plugin. This is my form which is embedded in tabbed pane.
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags" %>
<%# taglib prefix="sj" uri="/struts-jquery-tags"%>
<s:if test="appSetting != null">
<h3>Application settings</h3>
<div id="status" class="welcome"></div>
<table>
<tr>
<td>
<s:form id="form" action="updateMySettings" theme="xhtml">
<s:textfield id="screenRes" key="appSetting.screenResolution"
label="Screen resolution" required="true" />
<s:select key="appSetting.screenDepth" label="Color depth"
list="#{'8':'8','16':'16','24':'24'}" required="true" />
<sj:submit id="updateSetting" value="Update Settings" targets="status" validate="true" />
</s:form>
</td>
<td valign="top">
<button id="fullScreen">Use full screen</button>
<button id="fullBrowser">Use full browser</button>
</td>
</tr>
</table>
<script>
$("#fullScreen").click(function() {
scr_width = Math.max(screen.width,screen.height);
scr_height = Math.min(screen.width,screen.height);
$("#screenRes").val(scr_width + 'x' + scr_height);
});
$("#fullBrowser").click(function() {
brw_width = Math.max(window.innerWidth, window.innerHeight);
brw_height = Math.min(window.innerWidth, window.innerHeight);
$("#screenRes").val(brw_width + 'x' + brw_height);
});
$("#updateSetting").click(function() {
$("#status").empty();
})
</script>
</s:if>
<s:else>
<p>No settings available.</p>
</s:else>
It works very well.
You are step in an solved Struts2 Issue. Upgrade to latest version 2.3.3 or 2.3.4 and your problem should be gone.
Use ItemOperations to get a message:
How do I get the Headers in Particular the MessageID for the Email?
I'm confused the example on MSDN clearly shows the email Header.
http://msdn.microsoft.com/en-us/library/ee220018%28v=EXCHG.80%29.aspx
Am I missing an additional command/field/Flag?
Thanks,
Pat
Environment
Exchange 2003 Protocol: 12.1 ActiveSync
IN:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ItemOperations xmlns:airsync=\"AirSync:\" xmlns:airsyncbase=\"AirSyncBase:\" xmlns=\"ItemOperations:\">
<Fetch>
<Store>Mailbox</Store>
<airsync:CollectionId>6</airsync:CollectionId>
<airsync:ServerId>6:1</airsync:ServerId>
<Options>
<airsync:MIMESupport>1</airsync:MIMESupport>
<airsyncbase:BodyPreference>
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:TruncationSize>5120</airsyncbase:TruncationSize>
<airsyncbase:AllOrNone>0</airsyncbase:AllOrNone>
</airsyncbase:BodyPreference>
</Options>
</Fetch>
</ItemOperations>
OUTPUT:
XML Response:
<?xml version="1.0" encoding="utf-8"?>
<itemoperations:ItemOperations xmlns:itemoperations="ItemOperations:">
<itemoperations:Status>1</itemoperations:Status>
<itemoperations:Response>
<itemoperations:Fetch>
<itemoperations:Status>1</itemoperations:Status>
<airsync:CollectionId xmlns:airsync="AirSync:">6</airsync:CollectionId>
<airsync:ServerId xmlns:airsync="AirSync:">6:1</airsync:ServerId>
<airsync:Class xmlns:airsync="AirSync:">Email</airsync:Class>
<itemoperations:Properties>
<email:To xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc&g
t;</email:To>
<email:From xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc
></email:From>
<email:Subject xmlns:email="Email:">TESTMAIL</email:Subject>
<email:DateReceived xmlns:email="Email:">2011-12-06T15:22:24.613Z</email
:DateReceived>
<email:DisplayTo xmlns:email="Email:">pat2 pm. mol</email:DisplayTo>
<email:ThreadTopic xmlns:email="Email:">TESTMAIL</email:ThreadTopic>
<email:Importance xmlns:email="Email:">1</email:Importance>
<email:Read xmlns:email="Email:">1</email:Read>
<airsyncbase:Body xmlns:airsyncbase="AirSyncBase:">
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:EstimatedDataSize>1627</airsyncbase:EstimatedDataSize>
<airsyncbase:Data><html>
<head>
<style>
<!--
#font-face
{font-family:"Cambria Math"}
#font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
#page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
{}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"> </p>
</div>
</body>
</html>
</airsyncbase:Data>
</airsyncbase:Body>
<email:MessageClass xmlns:email="Email:">IPM.Note</email:MessageClass>
<email:InternetCPID xmlns:email="Email:">20127</email:InternetCPID>
<email:Flag xmlns:email="Email:" />
<email:ContentClass xmlns:email="Email:">urn:content-classes:message</em
ail:ContentClass>
<airsyncbase:NativeBodyType xmlns:airsyncbase="AirSyncBase:">2</airsyncb
ase:NativeBodyType>
</itemoperations:Properties>
</itemoperations:Fetch>
</itemoperations:Response>
</itemoperations:ItemOperations>
You have set airsyncbase:Type = 2. This gives you an HTML response.
You need to set Type = 4 if you want a full MIME response. That will have all the headers that you need.
See 2.2.2.22 Type of [MS-ASAIRS]: Exchange ActiveSync: AirSyncBase Namespace Protocol at http://msdn.microsoft.com/en-us/library/hh475675(v=exchg.80).aspx.
Seems ok, but, first of all, you have to check if the request support a ASAcceptMultiPart:
http://msdn.microsoft.com/en-us/library/ee159875%28v=EXCHG.80%29.aspx
I have tried to do this refering to following link.
http://skypher.com/index.php/2008/07/28/function-list-for-php/
But no success.
Can you help me please.
It will be great if namesapces also parsed.
Never mind,
Notepad+= 5.4.5 unicode and function list 2.0 beta. I have succeded with
<Group name="Global Procedures" subgroup="" icon="8" child="16" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="^proc\s+" regexfunc="[\w_]+" regexend="" bodybegin="{" bodyend="}" sep="" /> </Group> <Group name="Namespaces" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="^namespace\s+eval\s+::" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="" sep="" /> </Group>
An html template is compiled into the application as a resource. A fragment of the HTML template looks like:
<A href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR>
%CAPTIONTEXT%
i like it like this because the larger resource HTML file contains styling, no-quirks mode, etc.
But as is always the case, they now want the option that the Anchor tag should be omitted if there is no link. Also if there is no caption, then the BR tag should be omitted.
Considered Technique Nº1
Given that i don't want to have to build entire HTML fragments in C# code, i considered something like:
%ANCHORSTARTTAGPREFIX%<A href="%PANELLINK%" target="_blank">%ANCHORSTARTTAGPOSTFIX%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%ANCHORENDTAGPREFIX%</A>%ANCHORENDTAGPOSTFIX%CAPTIONPREFIX%<BR>
%CAPTIONTEXT%%CAPTIONPOSTFIX%
with the idea that i could use the pre and postfixes to turn the HTML code into:
<!--<A href="%PANELLINK%" target="_blank">-->
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
<!--</A>--><!--<BR>
%CAPTIONTEXT%-->
But that is just rediculous, plus one answerer reminds us that it wastes bandwith, and can be buggy.
Considered Technique Nº2
Wholesale replacement of tags:
%AnchorStartTag%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%AnchorEndTag%%CaptionStuff%
and doing a find-replace to change
%AnchorStartTag%
with
"<A href=\"foo\" target=\"blank\""
Considered Technique Nº3
i considered giving an ID to the important HTML elements:
<A id="anchor" href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR id="captionBreak">
%CAPTIONTEXT%
and then using an HTML DOM parser to programatically delete nodes. But there is no easy access to a trustworthy HTML DOM parser. If the HTML was instead xhtml i would use various built-in/nativly available xml DOM parsers.
Considered Technique Nº4
What i actually have so far is:
private const String htmlEmptyTemplate =
#"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN\"""+Environment.NewLine+
#" ""http://www.w3.org/TR/html4/strict.dtd"">"+Environment.NewLine+
#"<HTML>"+Environment.NewLine+
#"<HEAD>"+Environment.NewLine+
#" <TITLE>New Document</TITLE>"+Environment.NewLine+
#" <META http-equiv=""X-UA-Compatible"" content=""IE=edge"">"""+Environment.NewLine+
#" <META http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"">"+Environment.NewLine+
#"</HEAD>"+Environment.NewLine+
#""+Environment.NewLine+
#"<BODY style=""margin: 0 auto"">"+Environment.NewLine+
#" <DIV style=""text-align:center;"">"+Environment.NewLine+
#" %ContentArea%"+Environment.NewLine+
#" </DIV>" + Environment.NewLine +
#"</BODY>" + Environment.NewLine +
#"</HTML>";
private const String htmlAnchorStartTag =
#"<A href=""%PANELLINK%"" target=""_blank"">";
//Image is forbidden from having end tag
private const String htmlImageTag =
#"<IMG border=""0"" src=""%PANELIMAGE%"" style=""%IMAGESTYLE%"">";
private const String htmlCaptionArea =
#"<BR>%CAPTIONTEXT%";
And i already want to gouge my eyeballs out. Building HTML in code is a nightmare. It's a nightmare to write, a nightmare to debug, and a nightmare to maintain - and it will makes things difficult on the next guy. i'm hoping for another solution - since i am the next guy.
My reputation points in this game already being low gives me the freedom to tell you quite plainly that you, sir or madame, are in serious need of XSLT. Failing this (and you probably will) you need to look at XML literals in VB.NET (which provides you with the template-based solution you are looking for...). Since I prefer to stay in C# (even though I was born and raised on VBA), I use XSLT.
Both of my unwelcome recommendations require the use of XHTML instead of HTML. This requirement alone is quite a turn off to many traditional developers. I can already see through your use of capital letters for HTML elements that you will find my remarks utterly useless. So I should stop writing now.
What about this: Store XML as your fragment:
<fragment type="link_img_caption">
<link href="%PANELLINK%" />
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" />
<caption text="%CAPTIONTEXT%" />
</fragment>
Pull it out, replace the placeholders with the "real" strings (that you have carefully XML-escaped of course),
...and use a simple XML transformation to produce HTML output:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="fragment" />
</xsl:template>
<xsl:template match="fragment[#type = 'link_img_caption']">
<xsl:choose>
<xsl:when test="link[#href != '']">
<a href="{link/#href}" target="_blank">
<img src="{img/#src}" style="{img/#style}" border="0" />
</a>
</xsl:when>
<xsl:otherwise>
<img src="{img/#src}" style="{img/#style}" border="0" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="caption[#text !='']">
<br />
<xsl:value-of select="caption/#text" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Other fragment types could be added because of the type attribute. There is much room to improve this, so look at it as an example of how it could be done.
Output:
<a href="%PANELLINK%" target="_blank">
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" border="0">
</a>
<br>
%CAPTIONTEXT%
and, if the link href is empty in the XML:
<img src="%PANELIMAGE%" style="%IMAGESTYLE%" border="0">
<br>
%CAPTIONTEXT%
Use a templating engine, like one of these.
1.) Don't use comments, you'll send useless data to the browser wasting bandwidth and encountering BUGs in IE.
2.) Would this not be better as some sort of method? (I'm not familiar with C#) but something like this makes more sense to me.
//using PHP in this example
function HTMLImage($imageData, $linkData){
var str = '';
//if there is link data, start <a> tag
$str .= '<a '.{expand any attributes}.'>';
//add image tag and attributes from $imageData
$str .= '<img '.{expand any attributes}.'/>';
//if there is link data, close <a> tag
$str .= '</a>';
return $str;
}
I would use Template Toolkit, unfortunately it is currently only implemented in Perl and Python.
test.pl:
use Template;
my $template = Template->new({
VARIABLES => {
ImageStyle => "default",
CaptionText => "Place Caption Here"
},
});
$template->process( 'test.tt', {
panel => {
link => "http://Stackoverflow.com/",
image => "/Content/Img/stackoverflow-logo-250.png",
alt => "logo link to homepage"
}
} );
test.tt:
[% IF panel.link -%]
<A href="[% panel.link %]" alt="[% panel.alt %]" target="_blank">
[%- END -%]
[%- IF panel.image -%]
<IMG border="0" src="[% panel.image %]" style="[% ImageStyle %]">
[%- END -%]
[%- IF panel.link %]</A>[% END %]<BR>
[% CaptionText %]
Outputs:
<A href="http://Stackoverflow.com/" alt="logo link to homepage" target="_blank">
<IMG border="0" src="/Content/Img/stackoverflow-logo-250.png" style="default">
</A><BR>
Place Caption Here
If the variable panel.link isn't defined it skips the anchor tags.
<IMG border="0" src="/Content/Img/stackoverflow-logo-250.png" style="default">
<BR>
Place Caption Here
Templates are a serious code smell. Take a look at how Seaside generates html.
[Edit] Another one where someone without a clue downvoted.