Restart footnote numbering in each 'sect1' in Docbook - apache-fop

As the title describes my problem is that I want to reset the footnote numbering in each 'sect1', not just in each 'chapter' or 'appendix' and etc.
So far I couldn't manage to reset it. I've tried to copy a part of the footnote.xsl to my customization layer and change it but it didn't have any effect.
<xsl:template match="footnote" mode="footnote.number">
<xsl:choose>
<xsl:when test="string-length(#label) != 0">
<xsl:value-of select="#label"/>
</xsl:when>
<xsl:when test="ancestor::table or ancestor::informaltable">
<xsl:variable name="tfnum">
<xsl:number level="any" from="table|informaltable" format="1"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($table.footnote.number.symbols) >= $tfnum">
<xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number level="any" from="table|informaltable"
format="{$table.footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="fnum">
<!-- * Determine the footnote number to display for this footnote, -->
<!-- * by counting all foonotes, ulinks, and any elements that have -->
<!-- * an xlink:href attribute that meets the following criteria: -->
<!-- * -->
<!-- * - the content of the element is not a URI that is the same -->
<!-- * URI as the value of the href attribute -->
<!-- * - the href attribute is not an internal ID reference (does -->
<!-- * not start with a hash sign) -->
<!-- * - the href is not part of an olink reference (the element -->
<!-- * - does not have an xlink:role attribute that indicates it is -->
<!-- * an olink, and the hrf does not contain a hash sign) -->
<!-- * - the element either has no xlink:type attribute or has -->
<!-- * an xlink:type attribute whose value is 'simple' -->
<!-- * -->
<!-- * Note that hyperlinks are counted only if both the value of -->
<!-- * ulink.footnotes is non-zero and the value of ulink.show is -->
<!-- * non-zero -->
<!-- FIXME: list in #from is probably not complete -->
<xsl:number level="any"
from="chapter|appendix|preface|article|refentry|bibliography|sect1"
count="footnote[not(#label)][not(ancestor::table) and not(ancestor::informaltable)]
|ulink[$ulink.footnotes != 0][node()][#url != .][not(ancestor::footnote)][$ulink.show != 0]
|*[node()][#xlink:href][not(#xlink:href = .)][not(starts-with(#xlink:href,'#'))]
[not(contains(#xlink:href,'#') and #xlink:role = $xolink.role)]
[not(#xlink:type) or #xlink:type='simple']
[not(ancestor::footnote)][$ulink.footnotes != 0][$ulink.show != 0]
"
format="1"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($footnote.number.symbols) >= $fnum">
<xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number value="$fnum" format="{$footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Well, I guess this is the rule for footnote numbering reset. As I tried to modify this part of 'footnote.xsl', it didn't work and the xsltproc returned with a bunch of errors.
Like this:
Undefined namespace prefix.
1 object left on the stack.

Related

how to move billing address before payment method list using CSS magento 2?

I tried too much in vender but don't able to change the position of billing address on payment page.
I copied vender/magento/module_checkout/view/frontend/web/template/payment.html
file and putted at my module
company/module/view/frontend/web/template/payment.html
<!-- ko foreach: getRegion('beforeMethods') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<!-- ko foreach: getRegion('afterMethods') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<div id="checkout-payment-method-load" class="opc-payment" data-bind="visible: isPaymentMethodsAvailable">
<!-- ko foreach: getRegion('payment-methods-list') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
afterMethod put before payment-method-load but no luck
can anyone help me!
Add css to your style this will help you
#co-payment-form .fieldset {
display: -webkit-flex;
-webkit-flex-direction: column;
display: flex;
flex-direction: column;
}
.checkout-billing-address {
flex:1;
order: 1;
}
.opc-payment {
flex:1;
order: 2;
}
.opc-payment-additional {
flex:1;
order: 3;
}
After doing these changes run deploy command using cli
flush cache
Happy Coding!

How to change "true/false" to "yes/no" for Form Responses in Ektron

When there are checkboxes on the form, after the form is submitted with email recipients , the emailed response shows "true/false" if the checkbox is "checked/unchecked". Our staffs think it's not very user-friendly as "T/F" seems to be more of a technical term.
How could we change it to "Yes" for checked and "No" for unchecked respectively? "
Version: 8.50 SP2(Build 8.5.0.356)
That's funny; I had the opposite problem with smart forms because those checkboxes are stored in the XML as "yes" and "no". Consequently, I created this extension method for converting a string value into a boolean. "True", "1", and "yes" all convert to a true value.
public static class StringExtensions
{
public static bool ToBoolean(this string str)
{
bool result;
if (str == null)
return false;
if (bool.TryParse(str, out result))
return result;
return str.Trim() == "1" || string.Equals(str, "yes", StringComparison.OrdinalIgnoreCase);
}
}
You'll probably want to look at this file: /workarea/controls/forms/template_buildDataValue.xslt
It is referenced from within this file: /workarea/controls/forms/template_FormFieldValue.xslt
The buildDefaultValue xslt has this loop:
<xsl:for-each select="$data">
<xsl:choose>
<xsl:when test="$field/#datalist">
<xsl:variable name="displayValue" select="$fieldlist/datalist[#name=$field/#datalist]/item[#value=normalize-space(current())]"/>
<xsl:choose>
<xsl:when test="$displayValue">
<xsl:copy-of select="$displayValue/node()"/>
</xsl:when>
<xsl:when test="string-length(normalize-space(.))=0">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="./node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$field/#basetype='calendar' or $field/#datatype='date'">
<xsl:call-template name="buildDate"/>
</xsl:when>
<xsl:when test="string-length(normalize-space(.))=0">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="$field/#basetype='textbox' or $field/#datatype='textarea'">
<pre style="white-space:pre;word-wrap:break-word;"><xsl:copy-of select="./node()"/></pre>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="./node()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position() != last()">
<br />
</xsl:if>
</xsl:for-each>
You should be able to add another <xsl:when> element inside the outer <xsl:choose> element and test for the particular $field/#basetype you want.
These files are from the v9.0 workarea, but form emails haven't changed much since v8.5, so hopefully the files are at least very similar for you.
Also, this post may be of help: Customize Ektron HTML Form Email Layout

Umbraco XSLT search page navigation using input onchange

I have created a pagination input that on change will go to the value entered into the input.
It will detect the page range and allow navigation between those pages in that range.
e.g /image-gallery-album-1.aspx?page=3
<form type="get" onchange="return false">
<div class="pagerUI">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- previous page -->
<xsl:if test="$page > 1">
<td class="pager-prev"><a class="previous" href="{concat('?page=', $page - 1, $qs)}" title="Previous page">‹</a></td>
</xsl:if>
<td>Page</td>
<td><input type="number" name="page" id="page" min="1" >
<xsl:choose>
<xsl:when test="$page=1">
<xsl:attribute name="value">1</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="value"> <xsl:value-of select="$currentPageNumber" /> </xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="max"> <xsl:value-of select="$numberOfPages"/> </xsl:attribute>
</input></td>
<td>of <xsl:value-of select="$numberOfPages"/></td>
<!-- next page -->
<xsl:if test="$page * $resultsPerPage < count($matchedNodes)">
<td class="pager-next"><a class="next" href="{concat('?page=', $page + 1, $qs)}" title="Next page">›</a></td>
</xsl:if>
</tr>
</table>
</div>
</form>
However, when I added this to the XSLTSearch code it doesn't work as the URL loses the search string.
So instead of navigating to: /image-search.aspx?search=football&page=3
It navigates to: /image-search.aspx?page=3 Which doesn't display any results on that page as it's missing the search criteria to display the search results.
I tried to change the form and include an "action" that would change the URL to include the search value but I can't include the input value as it's dynamic.
For example with the below form if I enter any value into the input the URL updates to following: /image-search.aspx?search=otbra&page= It's missing the entered number of the input value.
Search form with onchange and action and method post attributes:
<form type="get" onchange="return false">
<xsl:attribute name="method"> <xsl:text>post</xsl:text> </xsl:attribute>
<xsl:attribute name="action"> <xsl:text>?search=</xsl:text> <xsl:value-of select="$search"/><xsl:text>&</xsl:text>page= (input value)</xsl:attribute>
Is there some javascript or some way of detecting the value submitted and parsing it into the search string of the URL?
Any assistance would be appreciated. Cheers, JV
NOTE: As comment on your post says the likely issue is with the $qs variable, however here's an explanation of how you can get Query String values in Umbraco, for reference.
In Umbraco you can retrieve a Query string value in XSLT using umbraco.library
So to retrieve the value of search you would call something like:
<xsl:variable name="searchValue" select="umbraco.library:RequestQueryString('search')"/>
This creates a variable called searchValue which you can then use to re-inject the query string value in your url.
Something like this:
<a class="next" href="{concat('?page=', $page + 1, '&search=', $searchValue)}" title="Next page">›</a>
More information on umbraco.library can be found on the our.umbraco.org site.

GWT doesn't render closed XHTML tags

I can't make GWT it generate valid XHTML. On our project we use table layout therefore there are many tables on the pages and they have <colgroup> tags along with <col> tags inside. The <col> tags are not closed regardless which doctype is put in the main HTML template. Both XHTML Transitional and XHTML String have been tried. The result is the same.
<table class="header-grid" cellpadding="0" cellspacing="0">
<colgroup>
<col class="header-left">
<col class="header-center">
<col class="header-right">
</colgroup>
<tbody>
...
</tbody>
</table>
<input> elements are not closed either. My guess that there could be other not properly closed elements, but they are not used in the application or I haven't found them.
FYI. GWT manipulates DOM and doesn't do any insertions to the inner HTML as text. It uses the JavaScript's appendChild(...) method along with doc.createElement(...).
The issue is reproduced in Chrome, Firefox and IE both in the Web and Dev modes. It occurs on the pages where UIBinder is not used.
GWT version: 2.4.0.
Main HTML:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="svg.render.forceflash" content="false"/>
<meta name="gwt:property" content="locale=en"/>
<meta http-equiv="X-UA-Compatible" content="IE=8, IE9"/>
<title>NPQ Facility Management</title>
<script src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="FMInsight.nocache.js"></script>
<script type="text/javascript" language="javascript" src="gr/abiss/js/sarissa/sarissa.js"></script>
<script type="text/javascript" src="js/svg-web/svg.js" data-path="js/svg-web" data-debug="false"></script>
<script type="text/javascript" src="js/svgviewer.js"></script>
<link media="all" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"
type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"
type="text/javascript" charset="utf-8"></script>
</head>
<body>
<iframe id="__printingFrame" style="width:0; height:0;border: 0"></iframe>
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
</body>
</html>
GWT XML file of the main module:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="FMInsight">
<!-- Inheriting the core Web Toolkit stuff. -->
<inherits name="com.google.gwt.user.User"/>
<inherits name="com.google.gwt.inject.Inject"/>
<inherits name="com.npq.fm.core.common.Commons"/>
<inherits name="com.npq.fm.svg.viewer.SvgViewer"/>
<!-- Inheriting the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by unommenting -->
<!-- any one of the following lines. -->
<inherits name="com.google.gwt.user.theme.standard.Standard"/>
<inherits name="com.google.gwt.user.theme.chrome.Chrome"/>
<!-- <inherits name="com.google.gwt.user.theme.dark.Dark"/> -->
<!-- Other module inherits. -->
<inherits name="com.google.gwt.xml.XML"/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name="com.google.gwt.http.HTTP"/>
<!-- Other module inherits. -->
<inherits name="com.google.gwt.user.ClippedImage"/>
<inherits name="com.google.gwt.maps.Maps" />
<!-- Compiled languages -->
<!-- In main file we set only EN language and only in compilation files,
that inherits from this file define what languages are allowed by
re-defining locale like in line below:
<extend-property name="locale" values="en,de,fr,nl,uk"/>
-->
<extend-property name="locale" values="en"/>
<set-property name="locale" value="en"/>
<set-property-fallback name="locale" value="en"/>
<!-- This property provider changes from GWT parameter name -->
<!-- for changing application locale from "locale" to -->
<!-- property "sap-language". -->
<property-provider name="locale"><![CDATA[
var defaultLocale = "en";
try {
var locale;
// Looking for the locale as a url argument in SAP way
if (locale == null) {
var args = location.search;
var startLang = args.indexOf("sap-language");
if (startLang < 0) {
startLang = args.indexOf("locale");
}
if (startLang >= 0) {
var language = args.substring(startLang);
var begin = language.indexOf("=") + 1;
var end = language.indexOf("&");
if (end == -1) {
end = language.length;
}
locale = language.substring(begin, end);
var lowerCase = locale.toLowerCase()
locale = lowerCase;
}
}
if (locale == null) {
// Looking for the locale on the web page
locale = __gwt_getMetaProperty("locale");
}
if (locale == null) {
return defaultLocale;
}
while (!__gwt_isKnownPropertyValue("locale", locale)) {
var lastIndex = locale.lastIndexOf("_");
if (lastIndex == -1) {
locale = defaultLocale;
break;
} else {
locale = locale.substring(0,lastIndex);
}
}
return locale;
} catch(e) {
alert("Unexpected exception in locale detection, using default=" + defaultLocale + ", " + e);
return defaultLocale;
}
]]></property-provider>
<!--
Inspired by Apache log4j PatternLayout:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
-->
<set-configuration-property name="log_pattern" value="%d [%-2p] %F %M: %m%n"/>
<!--<set-configuration-property name="log_pattern" value="%d [%-2p] %m%n"/>-->
<set-property name="log_FirebugLogger" value="ENABLED"/>
<set-property name="log_GWTLogger" value="ENABLED"/>
<set-property name="log_DivLogger" value="ENABLED"/>
<!-- Loggers are disabled by default -->
<set-property name="log_ConsoleLogger" value="DISABLED"/>
<set-property name="log_SystemLogger" value="DISABLED"/>
<set-property name="log_WindowLogger" value="DISABLED"/>
<!-- User Agent -->
<!-- In main file we set only user-agent to "ie8" and
only in compilation files, that inherits from this file we re-define
what user agents should be supported by re-defining locale like
in line below:
<set-property name="user.agent" value="gecko1_8,safari,ie6,ie8,ie9"/>
-->
<set-property name="user.agent" value="gecko1_8,safari"/>
<property-provider name="user.agent"><![CDATA[
var defaultUserAgent = "ie7";
var ua = navigator.userAgent.toLowerCase();
var makeVersion = function(result) {
return (parseInt(result[1]) * 1000) + parseInt(result[2]);
};
if (ua.indexOf("opera") != -1) {
return "opera";
} else if (ua.indexOf("webkit") != -1) {
return "safari";
} else if (ua.indexOf("msie") != -1) {
if (document.documentMode >= 8 && document.documentMode < 9) {
return "ie8";
} else if (document.documentMode >= 9) {
return "ie9";
} else {
return defaultUserAgent;
}
} else if (ua.indexOf("gecko") != -1) {
var result = /rv:([0-9]+)\.([0-9]+)/.exec(ua);
if (result && result.length == 3) {
if (makeVersion(result) >= 1008) {
return "gecko1_8";
}
}
return "gecko1_8";
}
return defaultUserAgent;
]]></property-provider>
<replace-with class="com.npq.fm.core.main.client.commons.browserspecific.impl.BrowserSpecificCommonsGecko">
<when-type-is class="com.npq.fm.core.main.client.commons.browserspecific.BrowserSpecificCommons" />
<any>
<when-property-is name="user.agent" value="gecko"/>
<when-property-is name="user.agent" value="gecko1_8" />
</any>
</replace-with>
<replace-with class="com.npq.fm.core.main.client.commons.browserspecific.impl.BrowserSpecificCommonsIE">
<when-type-is class="com.npq.fm.core.main.client.commons.browserspecific.BrowserSpecificCommons" />
<any>
<when-property-is name="user.agent" value="ie6"/>
<when-property-is name="user.agent" value="ie8" />
<when-property-is name="user.agent" value="ie9" />
</any>
</replace-with>
<replace-with class="com.npq.fm.core.main.client.commons.browserspecific.impl.BrowserSpecificSafari">
<when-type-is class="com.npq.fm.core.main.client.commons.browserspecific.BrowserSpecificCommons" />
<any>
<when-property-is name="user.agent" value="safari"/>
</any>
</replace-with>
<stylesheet src="FMInsight-main.css"/>
<stylesheet src="res_localized/default.css"/>
<!-- Specifying the app entry point class. -->
<entry-point class="com.npq.fm.core.main.client.Main"/>
<inherits name="org.cobogw.gwt.user.Button"/>
</module>
If this is happening client side, then GWT isn't generating tags at all. It is manipulating a DOM and you are using a tool to serialise it to HTML.
You might be able to persuade browsers to serialise to XHTML if you trigger XML parsing mode by serving the original document with an application/xhtml+xml content-type.
That said, HTML is the native markup language of browsers and it is best to use it to communicate with them. Instead of getting XHTML out, take HTML out and use an HTML parser at the place where you send the markup to.

Extra xml tag when using Lib:XSLT to create text file

Cross-post http://perlmonks.org/index.pl?node_id=979710
I'm trying to create a text file from some XML using Perl and Lib::XSLT, my transformation works fine except Lib::XSLT adds an unwanted ?xml version tag to the start of the file, how can I stop it doing this?
Here's my XSLT:
<xslt:stylesheet version="1.0" xmlns:data="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/generic" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:message="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xslt:param name="sep">|</xslt:param>
<xslt:output method="text" />
<xslt:template match="message:MessageGroup">
<xslt:for-each select="data:DataSet">
<!-- get dimensions (but not time) and store in dimensions variable -->
<xslt:for-each select="data:Series">
<xslt:variable name="dimensions">
<xslt:for-each select="data:SeriesKey">
<xslt:for-each select="data:Value">
<xslt:value-of select="#value" />
<xslt:value-of select="$sep" />
</xslt:for-each>
</xslt:for-each>
</xslt:variable>
<!--get obs statuses and store in obs statuses variable-->
<xslt:variable name="obsStatuses">
<xslt:for-each select="data:Attributes">
<xslt:for-each select="data:Value">
<xslt:value-of select="#value" />
</xslt:for-each>
</xslt:for-each>
</xslt:variable>
<!--write out dimensions variable, time, observation, obsstatuses variable-->
<xslt:for-each select="data:Obs">
<xslt:value-of select="$dimensions" />
<xslt:value-of select="data:Time" />
<xslt:value-of select="$sep" />
<xslt:value-of select="data:ObsValue/#value" />
<xslt:value-of select="$sep" />
<xslt:value-of select="data:Attributes/data:Value/#value"/>
<xslt:text>
</xslt:text>
</xslt:for-each>
</xslt:for-each>
</xslt:for-each>
</xslt:template>
</xslt:stylesheet>
Here's the Perl:
use Lib::XSLT;
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = XML::LibXML->load_xml(location => "$xmlFile");
my $style_doc = $parser->parse_file(Path::Class::File->new("$xsltFile"));
my $stylesheet = $xslt->parse_stylesheet($style_doc);
open OUTPUTFILE, ">>$outputFile" or die("Unable to open $outputFile, $!");
print OUTPUTFILE $stylesheet->transform($source);
close OUTPUTFILE;
Storing the result of $stylesheet->transform() and using $stylesheet->output_file() fixes this issue, e.g:
use Lib::XSLT;
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = XML::LibXML->load_xml(location => "$xmlFile");
my $style_doc = $parser->parse_file(Path::Class::File->new("$xsltFile"));
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
$stylesheet->output_file($results, $outputFile);
Why is the <?xml> declaration unwanted? It is valid XML and and has no influence on parsers.