Implementing schematron rules - schematron

I am new with schematron and I have the following problem. This is the snippet from xhtml file:
<div class="provision">
<!-- provision (SECTION) -->
<header>
<!-- headers -->
<div class="desig">
<!-- if provision then header/div#class=desig/span#class=num required -->
<span class="num">1.</span>
</div>
<h1 class="title">prov-title</h1>
</header>
<p class="prov">para-prov-level</p>
<p class="prov">para-prov-level</p>
<div class="glossary">
<!-- glossary -->
<!-- glossary requires dl -->
<dl>
<!-- dl should have dt, and at least one dd -->
<dt> term </dt>
<dd>definition</dd>
<dt> term </dt>
<dd>definition</dd>
</dl>
</div>
<div class="level-1-grp">
<!-- SUBSECTION -->
<header>
<div class="desig">
<span class="num">(1)</span>
</div>
</header>
<p class="level-1">para-level-1</p>
<div class="level-2-grp">
<header>
<div class="desig">
<span class="num">(a)</span>
</div>
</header>
<p class="level-2">para-level-2</p>
</div>
<div class="level-2-grp">
<header>
<div class="desig">
<span class="num">(b)</span>
</div>
</header>
<p class="level-2">para-level-2</p>
</div>
<p class="level-1">para-level-1</p>
</div>
<p class="prov">para-prov-level</p>
</div>
and I would like to create a rule to check
if there is a provision then header/div#class=desig/span#class=num required and glossary requires dl. I have been trying like this but it does not work:
<iso:pattern id="structure-provision">
<iso:title>Testing for Provision structure...</iso:title>
<iso:rule context="*:div[#class='provision']">
<iso:assert test="self::*:header/div[#class ='desig']/*:span[#class='num']">if provision then header/div#class=desig/span#class=num required</iso:assert>
</iso:rule>
</iso:pattern>
<!--glossory structure -->
<iso:pattern id="structure-glossory">
<iso:title>Testing for Provision structure...</iso:title>
<iso:rule context="*:div[#class='glossory']">
<iso:assert test="self::*:dl">glossary requires dl</iso:assert>
<iso:assert test="self::*:dl/dt">dl should have a dt</iso:assert>
</iso:rule>
</iso:pattern>
Any help would be appreciated. Thanks

You were missing a namespace on the div element in your first iso:assert.
The English language is not very precise, so I interpreted your requirements in 2 ways.
1) if there is a provision then (header/div#class=desig/span#class=num required AND glossary requires dl). "If X, then A and B". If this is the case, then only a single pattern should be used.
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<sch:pattern id="structure-provision">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='provision']">
<sch:assert test="*:header/*:div[#class ='desig']/*:span[#class='num']">
The provision structure requires header/div#class=desig/span#class=num
</sch:assert>
<sch:assert test="*:div[#class='glossary']/*:dl">
Glossary requires dl
</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>
2) (if there is a provision then header/div#class=desig/span#class=num required) AND (glossary requires dl). "If X, then A. Also, if Y, then B." If this is the case, then two patterns should be used.
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<sch:pattern id="provision-structure">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='provision']">
<sch:assert test="*:header/*:div[#class ='desig']/*:span[#class='num']">
The provision structure requires header/div#class=desig/span#class=num
</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern id="glossary-structure">
<sch:title>Provisioning structure</sch:title>
<sch:rule context="*:div[#class='glossary']">
<sch:assert test="*:dl">
Glossary requires dl
</sch:assert>
<sch:assert test="*:dl/*:dt">
dl requires dt
</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>
I would recommend splitting your requirements up into several rules/patterns to make things more robust and organized. For example, have all of your rules related to provisioning structure within a single pattern. If glossary rules should be enforced regardless of whether the glossary is within a provisioning structure, then glossary should have its own pattern.
Also, I would define and use a namespace for the elements and use that within the schematron rules. I assume it is xhtml or similar? The xpath expressions would become something like:
<sch:rule context="xhtml:div[#class='provision']">
<sch:assert test="xhtml:header/xhtml:div[#class ='desig']/xhtml:span[#class='num']">
Rule text here
</sch:assert>
</sch:rule>

Related

Angular 2 INTERNATIONALIZATION (I18N):Not able find target tag in ganerated xlf file

i am using angular-cli, followed angular-io to generate in Spanish language.
app.component.html
<h2 i18n="header">Login form</h2>
<div>
<span i18n>Email</span>
<input type="text" placeholder="Your email" i18n-placeholder>
</div>
<div>
<span i18n>Password</span>
<input type="password" placeholder="Password" i18n-placeholder>
</div>
<hr>
<div i18n>If you want to search something, go to Google</div>
message.es.xlf
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
</body>
</file>
</xliff>
getting generated message.es.xlf file once completing ./node_modules/.bin/ng-xi18n,but not able to find target tag in that file.
please help me
A little late but may help someone. Had the same problem, I resolved it by specifying the output file:
./node_modules/.bin/ng-xi18n --i18nFormat=xmb --outFile=messages.xmb
It is 2019, when I come back to Angular, and I found this same issue. The problem is that your XLF file must have a pair of target tags for every pair of source tags. You may add those tags manually, probably by copying and pasting and renaming the source tags, or you may use this script:
https://github.com/geocarlos/angular-i18n-target-tagger

How to publish additional postgis raster layer attributes in geoserver?

i was wondering if any of You can help me with my problem. I'm storing some rasters in Postgis database. Each raster is in its own table and besides 'rid' and 'rast' columns, I manualy added other columns to store raster attributes such as 'metadata'...
I have successfully imported rasters in geoserver using ImageMosaic JDBC and in Layers Preview (OpenLayers) I can see rasters and use getFeatureInfo function, but the problem is that function getFeatureInfo returns table with correct pixel value , 'rid' field is empty (only table header apears) and no other attribute is shown (not even attribute header in table). I'm using default geoserver method for layer preview function.
mapping.postgis.xml.inc file
<!-- possible values: universal,postgis,db2,mysql,oracle -->
<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
<keyAttributeName name="rid" />
<textAttributeName name="metadata" />
</tileTable>
</mapping>
connect.postgis.xml.inc
<connect>
<!-- value DBCP or JNDI -->
<dstype value="DBCP"/>
<!-- <jndiReferenceName value=""/> -->
<username value="postgres" />
<password value="postgres" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/web_kartografija" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
layer.postgis.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.postgis.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.postgis.xml.inc">]>
<config version="1.0">
<coverageName name="jan"/> <!-- Name of the table in database -->
<coordsys name="EPSG:4326"/>
<!-- interpolation 1 = nearest neighbour, 2 = bilinear, 3 = bicubic -->
<scaleop interpolation="1"/>
<verify cardinality="false"/>
&mapping;
&connect;
</config>
I tried to include <textAttributeName name="metadata" /> as a column name where aditional data is stored, but still no effect. Can anobudy help me with this problem ? Thanks in advance !

How do I create a product/service through Sales and Purchase mode in Quickbooks using qbXML

I am trying to create a service in Quickbooks using sales and purchase mode but It only creating under sales or purchase mode even though I added sales and purchase mode. Can any one please give me the solution or any work around on this will be very much appreciated.
Edition: QBOE(6.0)
Below is the way that I am following to create a service in sales and purchase mode.
Am I missing any thing or is there any thing that I need to do at QuickBooks side apart from this?
<ItemServiceAddRq>
<ItemServiceAdd>
<Name>QBTubes</Name>
<SalesAndPurchase>
<SalesDesc>Tubes are excellent for all ages</SalesDesc>
<SalesPrice>100</SalesPrice>
<FullName>Sales</FullName>
</IncomeAccountRef>
<PurchaseDesc>Tubes are excellent for all ages</PurchaseDesc>
<PurchaseCost>80</PurchaseCost>
<ExpenseAccountRef>
<ListID>IDTYPE</ListID>
<FullName>Purchases</FullName>
</SalesAndPurchase>
</ItemServiceAdd>
</ItemServiceAddRq>
Thanks in advance.
The QuickBooks Online qbXML API does not support creating an item with sales and purchase information.
You can verify this by using the QuickBooks OSR documentation -
Set the OSR to use qbXML 6.0 (QuickBooks Online only supports 6.0)
Check the 'OE' checkbox
Uncheck the 'US' checkbox
Choose "ItemServiceAdd" from the "Select Message" drop-down menu
The schema is defined as:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ItemServiceAddRq>
<ItemServiceAdd> <!-- required -->
<Name >STRTYPE</Name> <!-- required -->
<ParentRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</ParentRef>
<!-- BEGIN OR -->
<SalesOrPurchase> <!-- optional -->
<Desc >STRTYPE</Desc> <!-- optional -->
<!-- BEGIN OR -->
<Price >PRICETYPE</Price> <!-- optional -->
<!-- OR -->
<PricePercent >PERCENTTYPE</PricePercent> <!-- optional -->
<!-- END OR -->
<AccountRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</AccountRef>
</SalesOrPurchase>
<!-- OR -->
<!-- END OR -->
</ItemServiceAdd>
</ItemServiceAddRq>

<h:commandLink> action not invoke if include with <ui:include>

If I place inside an include file, the action will not call back bean.
Main File:
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<ui:include src="\test.xhtml" />
...
</h:panelGrid>
</h:form>
Include file (test.xhtml)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
</ui:composition>
The workaround is take out include file, directly place the code to main file as below:
Main file (without using include)
<h:form id="ifLogin">
<h:panelGrid
rendered="#{userSession.isLogin}"
columns="2" columnClasses="columnAlignLeft, columnAlignRight"
border="0" cellpadding="0">
<h:panelGrid border="0" columns="4">
<h:graphicImage value="#{msg.urlImageHome}"
style="height:26px;width:26px;" />
<f:subview>
<h:commandLink value="#{msg.home}" style="font-size: small;" immediate="true"
action="#{pageNavigationBean.updateCeaAppName}">
<f:param name="requestName" value="CEA_MAIN_PAGE" />
<f:param name="ceaAppName" value="" />
</h:commandLink>
</f:subview>
</h:panelGrid>
...
</h:panelGrid>
</h:form>
I use richface 4.3.1 Odd is this problem not happen when I run from local GAE. After deploy online to GAE, problem occour (i.e if using include then action will not trigger.
Is that a bug in jsf? or richface implementation or GAE? Any help?
Problem identify
It is not cause by using <ui:include>
The problem came out when the include file is dynamic generate from back bean, for example:
<ui:include src="#{pageNavigationBean.appDropDownMenuUrl}" />
If explicit mention the url, it work, for example:
<ui:include src="\test.xhtml" />
Well, if running from my local GAE, both way are working but when deploy online, I need use explicit location instead generate from bean. May be that is due to GAE problem where state is save at Client side (javax.faces.STATE_SAVING_METHOD).
I can't reproduce the problem with exactly the same included code (test.xhtml), but here are some recommendation:
Escape '>' characters (replace >>> by >>>)
Specify id attribute for f:subview (it is required according to tld)
Change backslash ('\') to slash ('/'). So inclusion would be <ui:include src="/test.xhtml" />

Search a string in file using C language

I am getting problem with FILEs concept in C language.
My problem is I have a html file , and that was opened in read mode.
I need to get the data from that file. The acurate is i between the two strings.
The strings are "<Response>" and "</Response>".
The text file is shown below.
<!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><title>
</title></head>
<body>
<form name="form1" method="post" action="pos_fis_transactions.aspx?trans=14%7c35381192%7c10-10-2011%7c1000.0%7c10-10-2011%7cCASH%7cCREDIT%7cc%7cGCC" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3NDI1ODEyMjhkZKgy7LmL8WTr+VEeDUOifRqzISfa" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEypqSAQKez72pDln9yKosD6kd+LvgBmdrWkYoLk2u" />
<div>
<textarea name="txtTransAck" rows="2" cols="20" id="txtTransAck">**<Response>14|245</Response>**</textarea>
</div>
</form>
</body>
</html>
In the above html file, I need to pick the data 14|25.
First of all you are not looking for <Response> and </Response> but <Resonse> and </Resonse> .
If the file is not too big, load it into memory and do a
strnstr( loadedFileContent, "<Response>", lengthOfLoadedFileContent );
This gives you a char pointer to the first & - now add strlen( "<Response>" ) to that, and you arive at your content.
Now either you know the length of your content and read it, or search from that position on for the nest & and take the string in between.
hth
Mario

Resources