The element tasklist may contain at most one title and at most one description, additionally any number (incl. 0) task elements in any order.
The naive approach is not applicable, since the order should not matter:
<!ELEMENT tasklist (title?, description?, task*) >
Alternatively, I could explicitly name all possible options:
(title, description?, task*) |
(title, task+, description?, task*) |
(task+, title, task*, description?, task*) |
(description, title?, task*) |
(description, task+, title?, task*) |
(task+, description, task*, title?, task*) |
(task*)
but then it's quite easy to write a non-deterministic rule, and furthermore it looks like the direct path to darkest madness. Any ideas, how this could be done more elegantly?
And no, an XSD or RelaxNG is no option. I need a plain, old DTD.
This summarises what you need:
<!ELEMENT tasklist (task*, ((title?, task*, description?) |
(description?, task*, title?)), task*)>
Alternation for the title appearing before/after description.
However, this is not a deterministic content model, as #13ren explains in his answer. [Here is another example from Microsoft](http://msdn.microsoft.com/en-us/library/9bf3997x(VS.71).aspx).
In short
Your requirements is to have a non-deterministic model, and as such, there is no possible valid DTD for your scenario.
Alternatives
If you place a simple restriction that either task or description must be the last element if both task and description are provided, you can use this deterministic DTD declaration:
<!ELEMENT tasklist (
task*,
((title, task*, description?) |
(description, task*, title?))?
)>
Examples:
<!-- Valid -->
<tasklist>
<task></task>
<task></task>
<task></task>
<title></title>
<task></task>
<description></description>
</tasklist>
<!-- Valid -->
<tasklist>
<title></title>
<task></task>
<task></task>
<task></task>
</tasklist>
<!-- Invalid
<tasklist>
<task></task>
<title></title>
<task></task>
<description></description>
<task></task>
</tasklist>
-->
Or, possibly more naturally, enforce that a title or description element must be the first element, and both title and description elements must exist or be non-existent.
<!ELEMENT tasklist (
((title, task*, description) |
(description, task*, title))?,
task*
)>
Examples:
<!-- Valid -->
<tasklist>
<title></title>
<task></task>
<description></description>
<task></task>
<task></task>
</tasklist>
<!-- Invalid
<tasklist>
<task></task>
<title></title>
<description></description>
<task></task>
<task></task>
</tasklist>
<tasklist>
<title></title>
<task></task>
<task></task>
<task></task>
</tasklist>
-->
Otherwise
Otherwise, you need to use RELAX NG, which allows for non-deterministic models.
Why is the order unimportant?
It seems to me as if the order is rather a bit important right here; and that the only sensible order is title?, description?, task*.
Flexibility is nice and all, but sometimes it's just not neccessary.
Related
Since 2007, we have used a local DTD to add a tag-pair and to define several attributes for PayPlal and google++. This is the local DTD...
<!ELEMENT havindex EMPTY>
<!ATTLIST havindex id CDATA #REQUIRED>
<!ENTITY % head.misc "(script|style|meta|link|object|isindex|havindex)*">
<!ENTITY % html.transitional PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- =========== 3 div attributes for googleplus share button ====== -->
<!ATTLIST div data-action CDATA #IMPLIED>
<!ATTLIST div data-annotation CDATA #IMPLIED>
<!ATTLIST div data-height CDATA #IMPLIED>
<!ATTLIST div data-id CDATA #IMPLIED>
<!-- =========== 2 script attributes for paypal support ========== -->
<!ATTLIST script data-pp-pubid CDATA #IMPLIED>
<!ATTLIST script data-pp-placementtype CDATA #IMPLIED>
%html.transitional;
... We recently converted the entire site to https (not sure that has anything to do with it, but just as an aside - checkout stuff was always htts, of course) and all of a sudden, it seems that the local DTD breaks the W3C validation - it fails immediately on the DTD. When I use a standard DTD, of course, the new tag and attributes are seen as validation errors. Any thoughts on how to use the local dtd or to define the attributes, at least?
The error is "500 Can't connect to www.WHATEVER-SITE.com:443" ... the site is https and on 443.
Anyway - TIA for any suggestions.
I read some Xpath code, some begin with "/xxxx", some begin with "//xxxx". What're their differences? Do they have different behavior just in "Select" or different also in other behaviors?
I didn't find corresponding explanations on this site, any hints?
Thanks.
Beginning an XPath with one slash will retrieve the root of the document, so that /xxxx will match only the <xxxx> element that is the root of the XML.
Example:
<?xml version="1.0"?>
<xxxx> <!-- this one will match -->
<level>
<xxxx /> <!-- this one won't -->
</level>
</xxxx>
Whereas //xxxx will match all <xxxx> elements anywhere in the document.
Example:
<?xml version="1.0"?>
<xxxx> <!-- this one will match -->
<level>
<xxxx /> <!-- this one will match as well -->
<sublevel>
<xxxx /> <!-- and also this one -->
</sublevel>
</level>
</xxxx>
To keep this as brief as possible, I have implemented a Neural Network in Java that originally was written as just an example of XOR.
This works great, so I moved on to a proof of concept on loading up the input's/output's of the NN. I've changed the algorithm to take in binary and read what number its suppose to be seeing. with 2 bits, or 3 bits as the input, I can get great results with the expected output.
-- --> 0.000
-O --> 1.000
O- --> 2.000
OO --> 3.000
and
--- --> 0.000
--O --> 1.000
-O- --> 2.000
-OO --> 3.000
O-- --> 4.000
O-O --> 5.000
OO- --> 6.000
OOO --> 7.000
Now, once I increase the bits input / output expected number to 4, I begin to run into problems.
---- --> 0.985
---O --> 0.985
--O- --> 3.160
--OO --> 3.160
-O-- --> 4.990
-O-O --> 4.990
-OO- --> 6.747
-OOO --> 6.747
O--- --> 8.094
O--O --> 8.094
O-O- --> 9.696
O-OO --> 9.696
OO-- --> 12.531
OO-O --> 12.531
OOO- --> 14.395
OOOO --> 14.395
What is the conceptual reason for this to occur? I have tried all types of hidden layer sizes and layer numbers with no difference in results.
I will output one more larger result.
----- --> 2.515
----O --> 2.515
---O- --> 2.515
---OO --> 2.515
--O-- --> 6.598
--O-O --> 6.598
--OO- --> 6.598
--OOO --> 6.598
-O--- --> 10.241
-O--O --> 10.241
-O-O- --> 10.241
-O-OO --> 10.241
-OO-- --> 14.364
-OO-O --> 14.364
-OOO- --> 14.364
-OOOO --> 14.364
O---- --> 18.190
O---O --> 18.190
O--O- --> 18.190
O--OO --> 18.190
O-O-- --> 22.319
O-O-O --> 22.319
O-OO- --> 22.319
O-OOO --> 22.319
OO--- --> 26.824
OO--O --> 26.824
OO-O- --> 26.824
OO-OO --> 26.824
OOO-- --> 30.966
OOO-O --> 30.966
OOOO- --> 30.966
OOOOO --> 30.966
As you can see, its possible to calculate the apparent "bunching" going on.
Thanks for any help!
Well, the answer came down to the number of bits in my response. Long story short, if you are using 1 output neuron for an integer expected output, the data type's number of bits is the output range...
The fix is output neuron return type's number of bits (Float 32, Double 64) is the range you should not exceed.
For my training set's expected results, I just ran a conversion of numberYouWant/maxNumberTheResultYouWantTheNetworkToBe * outputsDataSize
Basically, get it to count to 32 or 64 really well, and make any number system fit into that.
Thanks for no help :)
Eclipse marks this error
cvc-complex-type.2.4.a: Invalid content was found starting with element 'action-state'. One of '{"http://www.springframework.org/schema/webflow":on-end, "http://www.springframework.org/schema/webflow":output, "http://www.springframework.org/schema/webflow":exception-handler, "http://www.springframework.org/schema/webflow":bean-import}' is expected.
on this flow code
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
abstract="true">
<global-transitions>
<transition on="logIn" to ="login" />
<transition on="signup" to="signup"/>
<transition on="logOut" to="logout"/>
</global-transitions>
<action-state id="logout">
<evaluate expression="login.logout(currentUser)" />
<transition on="successLogout" to="main" />
<transition on="failLogout" to="error" />
</action-state>
I only find action-state samples and everyone are writting like my code and people use the same XSD. Either, I have read XSD file and on action-state section tag evaluate is missing. Why eclipse marks this error?
Thanks in advance!
I think there has to be an order in which the elements are defined. Try defining the action-state before the global-transitions. If you hover your mouse pointer over the "flow" xml definition in your xml file this info appears (among others):
Content Model : (attribute*, secured?, persistence-context?, var*, input*, on-start?, (action-state | view-state | decision-state | subflow-state | end-state)*, global-transitions?, on-end?, output*, exception-handler*, bean-import*)
So, there is a strict sequence.
I have a DITA topic map that contains a subject scheme map that defines a taxonomy.
The topics in my topic map have been tagged with values from the taxonomy.
How can I render my topic map with facets to allow retrival of the topics, where the facets are the values from the subject scheme map?
John.
DITA 1.2 gives you the means to create a taxonomy or facet hierarchy -- the subjectScheme map -- and the means to apply the taxonomy or facet hierarchy to your DITA content -- the classification map.
To take advantage of that markup and implement a faceted-browsing experience, you need two things:
A processor that uses the subject classification values as it renders the output
A viewing application that implements faceted browsing
Currently, I am not aware of any DITA processors or viewing applications that do this.
Well, unless I'm misunderstanding the question, I assume you mean rendering to XHTML and that you want the facet metadata in the output for use in retrieval there by the end user? And I guess you want it in a meta tag then.
If so, I would do it like this:
For the sake of the example, I will assume that you have made a taxonomy that maps to the #product attribute.
First, in the stylesheet dita2htmlImpl.xsl, find the following template and copy it to your custom.xsl to override it (as an alternative you could do another override the get-meta template in get-meta.xsl, but it's so long...), and add a call to generateProductMetadata:
<xsl:template match="*" mode="chapterHead">
<head><xsl:value-of select="$newline"/>
<!-- initial meta information -->
<xsl:call-template name="generateCharset"/> <!-- Set the character set to UTF-8 -->
<xsl:call-template name="generateDefaultCopyright"/> <!-- Generate a default copyright, if needed -->
<xsl:call-template name="generateDefaultMeta"/> <!-- Standard meta for security, robots, etc -->
<xsl:call-template name="getMeta"/> <!-- Process metadata from topic prolog -->
<xsl:call-template name="copyright"/> <!-- Generate copyright, if specified manually -->
<xsl:call-template name="generateCssLinks"/> <!-- Generate links to CSS files -->
<xsl:call-template name="generateChapterTitle"/> <!-- Generate the <title> element -->
<xsl:call-template name="gen-user-head" /> <!-- include user's XSL HEAD processing here -->
<xsl:call-template name="gen-user-scripts" /> <!-- include user's XSL javascripts here -->
<xsl:call-template name="gen-user-styles" /> <!-- include user's XSL style element and content here -->
<xsl:call-template name="processHDF"/> <!-- Add user HDF file, if specified -->
<xsl:call-template name="generateProductMetadata"/> <!-- Add Product metadata -->
</head>
<xsl:value-of select="$newline"/>
</xsl:template>
Then, again in your custom.xml, add the template you called:
<xsl:template name="generateProductMetadata">
<meta name="product" content="{#product}"/>
<xsl:value-of select="$newline"/>
</xsl:template>
This gives me the following result in a test run:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="copyright" content="(C) Copyright 2005"/>
<meta name="DC.rights.owner" content="(C) Copyright 2005"/>
<meta name="DC.Type" content="topic"/>
<meta name="DC.Title" content="Technical data"/>
<meta name="DC.Relation" scheme="URI" content="18014398553839499_Technical_description.html"/>
<meta name="DC.Creator" content="Administrator"/>
<meta name="DC.Contributor" content="Administrator"/>
<meta name="DC.Date.Created" content="2013-03-05T11:13:04"/>
<meta name="DC.Date.Modified" content="2012-12-17T11:11:02"/>
<meta name="class" content="InfoType04"/>
<meta name="wf-state" content="NotReleased"/>
<meta name="DC.Format" content="XHTML"/>
<meta name="DC.Identifier" content="topic18014398553854475"/>
<meta name="DC.Language" content="en"/>
<link rel="stylesheet" type="text/css" href="commonltr.css"/>
<title>Technical data</title>
<meta name="product" content="product1"/>
</head>
Is that what you're looking for?