When I try to write a template with match I am not getting correct results.
Input :
<row>
<entry align="left" nameend="8" namest="1" valign="top">
<p type="Table Title">TABLE 12. ELECTRICITY GENERATION
(BILLION kW<tps:c type="_Table Light Blue grid ALL">·</c>h) IN ALTERNATIVE
SCENARIOS</p>
</tps:entry>
<entry align="left" nameend="8" namest="1" valign="top">
<p type="Table Title">TABLE 12. ELECTRICITY GENERATION
(BILLION kW<tps:c type="_Table Blue grid ALL">·</c>h) IN ALTERNATIVE
SCENARIOS</p>
</tps:entry>
</row>
Used code :
<xsl:template match="entry/p/c[#type != ('_Table Blue grid ALL' , '_Table Light Blue grid ALL' , '_Table Light Blue')]
I want to select c nodes where mentioned attribute values don't contain(not equal). But every c nodes are selected when I used Used code. How can I resolve this.
You current expression will return true if the c value is not equal to just one of the selected values, not all of them, so effectively it will always be true.
You want to do this..
<xsl:template match="entry/p/c[not(#type = ('_Table Blue grid ALL' , '_Table Light Blue grid ALL' , '_Table Light Blue'))]" />
Do note this assumes you accounted for namespaces (with xpath-default-namespace perhaps)?
Related
I hope someone can point me in the right direction on how to change the background color of a column in Zurb Foundation for Emails 2 while using the Sass version. Is there a way to set the background color for the column or row ?
I tried multiple things but for some reason cant apply a style to columns or row.
body,
html,
h4.topline {
text-align: center;
color: rgb(0, 255, 85);
background: red;
}
p.value {
text-align: center;
color:indigo;
font-weight: bold;
background: greenyellow
}
div.test{
background: greenyellow
}
.columns.descr {
text-align: center;
color: gainsboro;
font-weight: bold
}
.row.test{
border-width: thick;
border-color: aqua
}
</style>
<container class="body-notify">
<row>
<columns small="12" large="12" >
<spacer size="10"></spacer>
<h4 class="topline">Information</h4>
</columns>
</row>
<row>
<div class="test">
<columns class="descr" small="12" large="6">Description 1</columns>
</div>
<columns small="12" large="6"><p class="value">Value 1</p></columns>
</row>
<row>
<columns small="12" large="6">Description 1</columns>
<columns small="12" large="6"><p class="value">Value 2</p></columns>
</row>
</container>
I work last year on the email marketing and I know some things , you can't add any style of css in email styles. so I think you can add background color inline on your div like this :
<div class="row" style="backgound:red;"></div>
A bit late on this, but hopefully it will still help! The columns element is part of the Inky templating markup and if you inspect it in the browser you'll see that this is actually a <th> element with the class name columns. So you should be able to target it with th.columns:
th.columns.descr {
text-align: center;
color: gainsboro; font-weight: bold }
Similarly, <row> in html markup is a table element so try table.row { add css here }
Also be wary of using <div> tags in html emails - they get stripped by some email clients. From the Foundation docs
When it comes to making emails, divs aren’t a thing. Don’t kill the messenger, but it’s true. It's not fun finding out we can't just use a with auto left and right margins for centering, or background colors; it won't work with most email clients. <div>'s can still be used for targeting CSS and for grouping semantically related elements, but shouldn’t be used for structural purposes or spacing.
You can use the <wrapper> element (also inky templating markup) instead. In actual html this is a table element with the class of wrapper, so if you needed to target this with sass it would be
table.wrapper
I'm using a fresh installation of Foundation for Email, and have the following test set up:
<container>
<wrapper>
<row>
<columns large="5" valign="middle">
<img src="https://placehold.it/690x173" alt="Company Logo">
</columns>
<columns large="7" valign="middle">
<h4 style="margin-bottom: 0;" class="text-right small-text-center">Thanks for your order!</h1>
</columns>
</row>
</wrapper>
</container>
I expected the logo and the title to be vertically centered in their container. However, as you can see in the screenshot, there is extra white space at the bottom:
Even the example in the documentation seems to be working incorrectly. The items are not vertically aligned in the center of their container.
What am I missing here? Why doesn't the valign attribute function as the documentation suggests?
The _normalize.scss file applies vertical-align: top; to table, tr, td and th tags. This messes with the vertical alignment.
For this reason, you will need to add vertical-align: middle; to the tag as well:
<wrapper>
<row style="border: 1px solid black;">
<columns large="5" valign="middle" style="vertical-align: middle;">
<img src="https://placehold.it/690x173" alt="Company Logo">
</columns>
<columns large="7" valign="middle" style="vertical-align: middle;">
<h4 class="text-right small-text-center">Thanks for your order!</h1>
</columns>
</row>
</wrapper>
Padding and margins can influence the visual end result quite significantly too, but that's actually a separate issue from the vertical alignment of content within table cells.
I've not tested how well this fix will work in different devices/platforms however you can apply the below to your columns to remove the extra space in your row.
<wrapper>
<row style="border: 1px solid black;">
<columns large="5" valign="middle" style="padding-bottom: 0;">
<img src="https://placehold.it/690x173" alt="Company Logo">
</columns>
<columns large="7" valign="middle" style="padding-bottom: 0;">
<h4 style="margin: 0" class="text-right small-text-center">Thanks for your order!</h1>
</columns>
</row>
</wrapper>
When using CFdocument to create a pdf in CF10 I lose a lot of css. Is there any documentation anywhere that shows what css is allowed to be used for CFdocument or is it just keep trying and its hit or miss. Right now I am just trying to add a border-bottom style and it will not show whether its inline or a cascading style sheet.
Does anyone know where I can find what CSS can be used for CFdocument to help me make this border-bottom appear and other CSS that is not showing.
<cfdocument format="pdf" scale="75" backgroundvisible="yes" overwrite="no" fontembed="yes">
<tr style="border-bottom: solid 1px coral;">
It's right there with the documentation under Supported CSS Styles - cfdocument
I don't think the supported tags has changed since ColdFusion 9.
Supported CSS styles
The cfdocument tag supports the following CSS styles:
background
background-attachment
background-color
background-image
background-position
background-repeat
border
border-bottom
border-bottom-color
border-bottom-style (solid border only)
border-bottom-width
border-color
border-left
border-left-color
border-left-style (solid border only)
border-left-width
border-right
border-right-color
border-right-style (solid border only)
border-right-width
border-spacing
border-style (solid border only)
border-top
border-top-color
border-top-style (solid border only)
border-top-width
border-width
bottom
clear
clip
color
content (strings, counters only)
counter-increment
counter-reset
cursor
display
float
font
font-family
font-size
font-style
font-weight
height
left
letter-spacing
line-height
list-style-type
margin
margin-bottom
margin-left
margin-right
margin-top
outline
outline-color
outline-style (solid, dotted, dashed only)
outline-width
padding
padding-bottom
padding-left
padding-right
padding-top
page-break-after
page-break-before
page-break-inside
position
right
text-align (left, right, and center)
text-decoration
text-indent
top
unicode-bidi
vertical-align
visibility
white space (normal, nowrap only)
width
z-index
You Can Use CSS inside cfdocument like below :
<cfheader name="Content-Disposition" value="inline; filename=Example.pdf">
<cfcontent type="application/pdf">
<cfdocument format="pdf" orientation="landscape">
<style>
tr {padding-top: 5px}
td {font-size: 8px; padding-top: 2px}
</style>
<table>
<tr>
<td>
Example
</td>
</tr>
</table>
I resolved this issue by using a class on the tr like so.
tr.border_bottom td {
border-bottom:1pt solid black;
}
I have the following XSLT snippet:
<xsl:for-each
select="distinct-values(/summary/results[#count eq $currentResult]/simulator/host/tps)">
<th>
<small>
TPS Avg
<br></br>
</small>
</th>
<th>
<small>
TPS 95th%tile
<br></br>
</small>
</th>
</xsl:for-each>
Since, I have used distinct-values I would expect this to iterate once through the loop, but it iterates twice. Twice makes no sense even if distinct-values was not working properly, as there are 3 distinct instances of 'tps' in the XML document. Any ideas appreciated...
distinct-values on a node:
distinct-values(/summary/results[#count eq $currentResult]/simulator/host/tps
is different to distinct-values on an atomic value:
distinct-values(/summary/results[#count eq $currentResult]/simulator/host/tps/avg/text()
When you use a node, the children of that node have to be identical in order for it to extract one entry from the XML tree.
Consider the following:
<tps>
<avg>8.99</avg>
<percentile>11.0</percentile>
</tps>
<tps>
<avg>8.99</avg>
<percentile>11.0</percentile>
</tps>
<tps>
<avg>8.99</avg>
<percentile>10.0</percentile>
</tps>
You might think that select-distinct will only return one entry for <tps> here but it considers children in this case. In the case above there are 2 distinct nodes: avg and percentile are identical in two of the nodes. This is why it looped over the for-each twice.
I'm delving into XML and XSLT and am trying to generate a basic, tabular web page. The basic layout of the table seems to be ok, but I'm getting a column of " characters before I get my two-column table (which itself is in the second column of the web page). This is shown below:
There are exactly the number of " characters as there are elements of the XML file this is built from. The code that I think is causing the problem is listed below:
<tbody>
<xsl:for-each select="command">
<tr>
<td width="50%">
<xsl:value-of select="description"/>
</td>"
<td width="50%">
<xsl:value-of select="TLC"/>
</td>
</tr>
</xsl:for-each>
</tbody>
Is the character being generated in each xsl:for-each select? In the event that the above snippet of code looks good, I'll include the entirety of the XSLT file below. Feel free to let me know how dumpy my stuff looks, as I'm coming from a firmware and .NET background.
Thanks.
EDIT: Removed the full body of code since the answer, so obvious that I should smack myself, doesn't involve it.
The problem is right here:
</td>"
<td width="50%">
You're inserting a " which is not inside a cell, thus the browser displays it outside...
The code that I think is causing the
problem is listed below:
<tbody>
<xsl:for-each select="command">
<tr>
<td width="50%">
<xsl:value-of select="description"/>
</td>"
<td width="50%">
<xsl:value-of select="TLC"/>
</td>
</tr>
</xsl:for-each>
</tbody>
This is obvious: Just remove the " character in the 6th line of the above code snippet.