I have a SharePoint DVWP that is using a List as its Data Source. Within this list I two columns - LinkSection and SubSection
Within this DVWP I have "Sections" that group the items in this list. Up until now, each Section has only filtered by one column - see example of one section:
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows1" select="/dsQueryResponse/Rows/Row[contains(#LinkSection,'Training')]"/>
<div class="page_home" style=" height: 120px; overflow: hidden; z-index: 0;border:1px solid #CCCCCC;">
<div class="cat_heading" style="padding: 5px 10px; text-align: left; ">
<h2 style="font-weight:bold">
<a title="Section 1">Section 1</a>
</h2>
</div>
<div class="cat_imglinks" style=" height: 70px; overflow: hidden;">
<div class="cat_img" style="text-align: left; vertical-align: middle;">
<a>
<span style="width: 78%; float: left;">Section 1 Text</span>
</a>
</div>
<div class="panel cat_links">
<ul>
<xsl:for-each select="$Rows1">
<li><a href="{#Link}" title="{#Title}">
<xsl:value-of select="#Title" disable-output-escaping="yes"/></a></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:template>
I have a request now to filter by two columns. I do not have much experience with XSLT so I am trying things I have seen on forums such as this with no luck.
So, I want to create an AND filter for two Rows - see one of the ways I have tried below. I have tried using the "|" operator in the xsl:for-each line but this seems to display all items meeting the $Rows1 result.
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows1" select="/dsQueryResponse/Rows/Row[contains(#LinkSection,'Training')]"/>
<xsl:variable name="Rows2" select="/dsQueryResponse/Rows/Row[contains(#SubSection,'Education')]"/>
<div class="page_home" style=" height: 120px; overflow: hidden; z-index: 0;border:1px solid #CCCCCC;">
<div class="cat_heading" style="padding: 5px 10px; text-align: left; ">
<h2 style="font-weight:bold">
<a title="Section 1">Section 1</a>
</h2>
</div>
<div class="cat_imglinks" style=" height: 70px; overflow: hidden;">
<div class="cat_img" style="text-align: left; vertical-align: middle;">
<a>
<span style="width: 78%; float: left;">Section 1 Text</span>
</a>
</div>
<div class="panel cat_links">
<ul>
<xsl:for-each select="$Rows1 | $Rows2">
<li><a href="{#Link}" title="{#Title}">
<xsl:value-of select="#Title" disable-output-escaping="yes"/></a></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:template>
Any help would be greatly appreciated.
Thanks!
You currently have 2 variables:
<xsl:variable name="Rows1" select="/dsQueryResponse/Rows/Row[contains(#LinkSection,'Training')]"/>
<xsl:variable name="Rows2" select="/dsQueryResponse/Rows/Row[contains(#SubSection,'Education')]"/>
Instead of adding 'Rows2', just change 'Rows1' to:
<xsl:variable name="Rows1" select="/dsQueryResponse/Rows/Row[contains(#LinkSection,'Training')][contains(#SubSection,'Education')]"/>
Then change your for-each back to:
<xsl:for-each select="$Rows1">
Related
mostly trying to modify the email verification that is sent on sign-up following the allauth documentation the sent email is modified when i change email_confirmation_message.txt but when i want to use an html representaion the documentation says to use email_confirmation_message.html but it is not recognized and instead it sends the default email or if i include both it only sneds the text one and ignores the html
email_confirmation_message.html :
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Snippet - GoSNippets</title>
<link href='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css' rel='stylesheet'>
<link href='' rel='stylesheet'>
<script type='text/javascript' src=''></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js'></script>
<script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js'></script>
</head>
<body oncontextmenu='return false' class='snippet-body'>
<div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">We're excited to have you get started on {{ site_domain }}. First, you need to confirm your account. Just press the button below.</p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#FFA73B">Confirm Account</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr> <!-- COPY -->
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p>
</td>
</tr> <!-- COPY -->
</table>
<script type='text/javascript'></script>
</body>
</html>
{% endblocktrans %}{% endautoescape %}{% endblock %}
ok,so i figured it out. you have to also change email_confirmation_signup_message.txt
to email_confirmation_signup_message.html and inside it change {% include "account/email/email_confirmation_message.txt" %} to {% include "account/email/email_confirmation_message.html" %}
For each 'paymentSummaries' section, a new table will be created and
I've been able to get this to work. What isn't working is getting the
paymentSummary/splitCode/(number)(type)(policyDetails)(amountPaid) to
display (return) more than just the first instance in each table.
Here is my XML:
<paymentSummaries>
<billingAccountNumber>billingAccountNumber1</billingAccountNumber>
<paymentSummary>
<splitCode>
<number>paymentSummary1</number>
<type>type1</type>
<policyDetails>policyDetails1</policyDetails>
<amountPaid>amountPaid1</amountPaid>
</splitCode>
</paymentSummary>
<paymentSummary>
<splitCode>
<number>paymentSummary2</number>
<type>type2</type>
<policyDetails>policyDetails2</policyDetails>
<amountPaid>amountPaid2</amountPaid>
</splitCode>
</paymentSummary>
<serviceFee>serviceFee1</serviceFee>
<totalAmountPaid>totalAmountPaid1</totalAmountPaid>
</paymentSummaries>
This is what I've tried so far. The first example returns just the
first instance. The second example returns nothing/blank.
1st Example:
I have a <xsl:for-each
select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']">
wrapping around the entire table (this gets it to repeat the table for
each that's passed.
For the individual child and sibling elements, I haven't specified any
<for-each> or <if> tests because I thought it would just repeat the
instances.
2nd Example:
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number'] != ''">
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='amountPaid']"</xsl:value-of>
</div>
</td>
</xsl:if>
</tr>
<xsl:for-each select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][position() >1]">
<tr>
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='amountPaid']"></xsl:value-of>
</div>
</td>
</tr>
</xsl:for-each>
<tr bgcolor="#ffffff">
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='policyDetails'] != ''">
<td align="left" valign="top" style="padding: 0px 5px 8px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="175" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
</div>
</td>
<td width="270" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='splitCode'][1]/*[local-name()='policyDetails']" />
</div>
</td>
</tr>
</table>
</td>
</xsl:if>
</tr>
<table>
This is what I'm getting Table 1: paymentSummary1 type1 amountPaid1
policyDetails1 (this table is missing paymentSummary2, type2, etc.)
Table 2: paymentSummary3 type3 amountPaid3 (this table is
missing paymentSummary4, type4, etc.
policyDetails3
Any ideas how I can get this to work properly?
I think I can see what you are trying to do: put all of the payment summaries in a table followed by a single policyDetail
You start out by saying "For each 'paymentSummaries' section, a new table will be created ... "
So you want to start by doing that:
<xsl:template select='/'>
<xsl:for-each select='//paymentSummaries'>
<table>
<xsl:apply-templates select='paymentSummary'/>
<xsl:call-template name='policy'/>
</table>
</xsl:for-each>
</xsl:template>
next you ned to decide what you are going to do for each of the paymentSummary blocks. Here, I am just adding a new row to the table
<xsl:template match='paymentSummary'>
<tr>
<td>
<xsl:value-of select='splitCode/number'/>
</td>
<td>
<xsl:value-of select='splitCode/type'/>
</td>
<td>
<xsl:value-of select='splitCode/amountPaid'/>
</td>
</tr>
</xsl:template>
Finally, I add the policy part: note the call-template instead of apply-template as I only want to do this once.
<xsl:template name='policy'>
<tr>
<td>
<xsl:value-of select='paymentSummary[1]/splitCode/policyDetails'/>
</td>
</tr>
</xsl:template>
Once you have the general layout of what you want, go ahead and put in your own styling
I want to create a bootstrap accordion menu using xslt and read data from xml file. I have this xslt
<xsl:template match="/Settings">
<xsl:for-each select="Area">
<div class="panel-group configuration-menu-style" id="Menu">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#Menu" href="#{#Caption}">
<xsl:value-of select="#Caption"/>
</a>
</h4>
</div>
<div id="{#Caption}" class="panel-collapse collapse in">
<div class="panel-body custom-padding">
<table class="table">
<xsl:for-each select="Category">
<tr>
<td class="configuration-submenu-style">
<xsl:value-of select="#Caption"/>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</div>
</div>
</div>
</xsl:for-each>
In this line
<div id="{#Caption}" class="panel-collapse collapse in">
i give id based to attribute and works. Using developer tools in browser i can see that has id="MENU OPTION2" The problem is in this line
<a data-toggle="collapse" data-parent="#Menu" href="#{#Caption}">
<xsl:value-of select="#Caption"/>
</a>
Using developer tools in browser i can see that this element has href="#MENU%20OPTION2
So... how can remove %20 from href?
SOLUTION
<a data-toggle="collapse" data-parent="#Menu" href="#{position()}">
<div id="{position()}" class="panel-collapse collapse in">
BECAUSE 'id="MENU OPTION2" is not valid as id should not contain space'
id="MENU OPTION2" is not valid as id should not contain spaces
Just have a look at this:
What are valid values for the id attribute in HTML?
So I suggest you use "MENU_OPTION2" or "MENU-OPTION2" as there would be no difference when urlencoding those strings.
-- EDIT --
By the way, I just remembered that I already worked on this kind of subject long time ago... http://xul.ccoste.fr/
And if you have a look as my XSLT file http://xul.ccoste.fr/xul-bootstrap.xsl, I used generate-id() to be sure that there would never be any conflict between IDs.
<xsl:template match="tabs">
<ul class="nav nav-tabs">
<xsl:for-each select="tab">
<li>
<xsl:if test="position() = 1">
<xsl:attribute name="class"><xsl:text>active</xsl:text></xsl:attribute>
</xsl:if>
<a data-toggle="tab" href="#{generate-id(../..)}-{position()}">
<xsl:value-of select="#label" />
</a>
</li>
</xsl:for-each>
</ul>
I have a HTML table on a webpage and the table is empty. It contains no data as the data has been deleted by a previous test.
For this test I would like to check, verify the html table is empty, it contains no data.
What is the best way to check this? I was thinking of using an Xpath like the following:
//table[#id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality"]//tr//td//div[text()=""]
The HTML snippet is:
<table id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality" class="GFNQNVHJE border" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true" style="min-width: 350px;">
<thead aria-hidden="false">
<colgroup>
<tbody style="display: none;"/>
<tbody>
<tr>
<td align="center" colspan="2">
<div>
<div class="" style="width: 100%; height: 100%; padding: 0px; margin: 0px;" aria-hidden="false">
<div class="" style="width: 100%; height: 100%;" aria-hidden="false">
<div class="gwt-Label">No data to display.</div>
</div>
</div>
<div style="width: 100%; height: 100%; padding: 0px; margin: 0px; display: none;" aria-hidden="true">
<div class="GFNQNVHBE" style="width: 100%; height: 100%; display: none;" aria-hidden="true">
<div class="gwt-Label"></div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot style="display: none;" aria-hidden="true"/>
</table>
Thanks, Riaz
Assuming that the only visible text in the <table> when it is empty is "No data to display.", then you can simplify the XPath as follow (formatted for readability) :
//table[
#id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality"
and
.='No data to display.'
]
xpatheval demo
I'm trying to generate an HTML/CSS combination to display a contact sheet type view of a bunch of photos, each with some text and a form element or two. I'd like the view to fill available width and wrap as needed, in order to get as many images on screen as the user's display can manage. I think a 'ul' is the right container to use, with display set to inline, and I think it's OK to use tables for each of the elements. What I've got so far looks promising in Safari (images that are under-size in either dimension are centered within their cell, wrapping behaves as intended), but fails in FireFox. It also fails the w3c validator (no doctype), but as soon as I specify a doctype the layout breaks (list goes back to displaying in a single column in both browsers).
This is what I have so far:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Layout test</title>
<style type="text/css">
#contact_sheet li {
list-style-type: none;
display: inline;
text-align: center;
}
#contact_sheet li table {
width: auto;
border-spacing: 0px;
display: inline;
border: thin solid #202020;
background-color: #404040;
color: white;
}
#contact_sheet li th {
height: 250px;
width: 250px;
text-align: center;
vertical-align: middle;
}
#contact_sheet li td {
text-align: center;
}
th img {
border: thin solid green;
}
</style>
</head>
<body>
<ul id="contact_sheet">
<li>
<table>
<tr>
<th><img src="" width="240" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" height="240" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
</ul>
</body>
</html>
What am I doing wrong?
This happens because when the specific doctype, tables took up the entire width of the page.
Just make them float:left and it will work:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Layout test</title>
<style type="text/css">
#contact_sheet li {
list-style-type: none;
display: inline;
text-align: center;
}
#contact_sheet li table {
width: auto;
border-spacing: 0px;
display: inline;
border: thin solid #202020;
background-color: #404040;
color: white;
}
#contact_sheet li th {
height: 250px;
width: 250px;
text-align: center;
vertical-align: middle;
}
#contact_sheet li td {
text-align: center;
}
table {
float: left;
}
th img {
border: thin solid green;
}
</style>
</head>
<body>
<ul id="contact_sheet">
<li>
<table>
<tr>
<th><img src="" width="240" alt="" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" alt="" height="240" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
<li>
<table>
<tr>
<th><img src="" width="120" alt="" height="120" /></th>
</tr>
<tr>
<td>Some text</td>
</tr>
<tr>
<td><input type="checkbox" />Select</td>
</tr>
</table>
</li>
</ul>
</body>
Tables are at their best when the width can be predetermined. You may be better off without tables for your desired effect. I would suggest simply wrapping each img in a div. Float all the divs left and you're done. You then eliminate the need to specify new table rows, as each new row will be created when the floated divs wrap.
That also may make it easier to apply class styles to each individual image/form.
The main problem with this approach which may make it unworkable is that your images are of indeterminate size. One div would not affect the width of the div below it, leaving you without the order of a grid