Liza Program UI compiler
This is not in the state I hoped it to be in for a release, and hopefully it will see more public releases in the future. See the commit referenced by the liza repository v1.0.0 tag for more information.master v1.0.0
commit
52ceaa9b6b
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,17 @@
|
|||
This project could use some refactoring and redesign. It is old, and the
|
||||
author (mtg) didn't know XSLT (or much JS, even) when initially writing it.
|
||||
|
||||
See the TAME project for an example of modern XSLT that this could aspire
|
||||
to become.
|
||||
|
||||
This project was initially conceived as a way to generate static HTML and
|
||||
SQL for an existing rating system (that this eventually replaced by evolving
|
||||
into Liza and TAME). As such, it produces static HTML which is then
|
||||
processed by Liza (by picking metadata and such out of it). It also
|
||||
generates large chunks of JavaScript inline.
|
||||
|
||||
1. Stop generating HTML---just convert to JSON and let liza handle DOM
|
||||
generation.
|
||||
2. Stop this inline JS madness and use a core library (that would be part
|
||||
of liza).
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Liza Data Collection Framework Program UI Compiler
|
||||
<!--
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of liza-proguic.
|
||||
|
||||
Copying and distribution of this file, with or without modification, are
|
||||
permitted in any medium without royalty provided the copyright notice and
|
||||
this notice are preserved. This file is offered as-is, without warranty
|
||||
of any kind.
|
||||
-->
|
||||
|
||||
Compiles a declarative program definition ("program XML") into a format
|
||||
understood by Liza.
|
||||
|
||||
|
||||
## License
|
||||
liza-proguic is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
The full license is available in `COPYING`.
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Expand nodes during preprocessing
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lv="http://www.lovullo.com/rater"
|
||||
xmlns:lvp="http://www.lovullo.com"
|
||||
xmlns:preproc="http://www.lovullo.com/program/preprocessor"
|
||||
xmlns:assert="http://www.lovullo.com/assert"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<import href="program-preprocess.xsl" />
|
||||
|
||||
<function name="lvp:expand" as="document-node( element( lvp:program ) )">
|
||||
<param name="program" as="element( lvp:program )" />
|
||||
|
||||
<variable name="preproc"
|
||||
as="document-node( element( lvp:program ) )">
|
||||
<apply-templates select="$program" mode="preprocess" />
|
||||
</variable>
|
||||
|
||||
<document>
|
||||
<apply-templates mode="lvp:expand"
|
||||
select="$preproc/lvp:program" />
|
||||
</document>
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Unknown nodes are echoed and processing continues with their
|
||||
children; this allows the system to evolve independently from this
|
||||
expansion system.
|
||||
-->
|
||||
<template mode="lvp:expand"
|
||||
match="node()"
|
||||
priority="1">
|
||||
<copy>
|
||||
<sequence select="@*" />
|
||||
<apply-templates mode="lvp:expand" />
|
||||
</copy>
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
Text and comments are output verbatim.
|
||||
-->
|
||||
<template mode="lvp:expand"
|
||||
match="text()|comment()"
|
||||
priority="2">
|
||||
<copy>
|
||||
<copy-of select="@*" />
|
||||
<apply-templates mode="lvp:expand" />
|
||||
</copy>
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
@node Whens
|
||||
@section Whens
|
||||
|
||||
``Whens'' are predicates attached to elements; they state, simply,
|
||||
the condition under which the element should be visible.
|
||||
|
||||
They are provided as a space-delimited attribute, which is
|
||||
inconvenient to query and work with; we expand them here into nodes.
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
Expand ``when'' predicates into nodes. The original @code{@@when}
|
||||
attribute is retained.
|
||||
|
||||
Predicates are parsed expanded into @code{predicate} nodes
|
||||
referencing the the respective identifier.
|
||||
-->
|
||||
<template mode="lvp:expand"
|
||||
match="element()[ @when ]"
|
||||
priority="5">
|
||||
<copy>
|
||||
<sequence select="@*,
|
||||
lvp:expand-preds(
|
||||
lvp:parse-when( @when ),
|
||||
current() )" />
|
||||
|
||||
<apply-templates mode="lvp:expand" />
|
||||
</copy>
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
Parses the space-delimited ``when'' string @var{when} into a
|
||||
sequence of ref strings.
|
||||
-->
|
||||
<function name="lvp:parse-when" as="xs:string*">
|
||||
<param name="when" as="xs:string" />
|
||||
|
||||
<for-each select="tokenize( $when, ' ' )">
|
||||
<sequence select="." />
|
||||
</for-each>
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Some refs have special meanings in the form of @code{<type>:<ref>};
|
||||
otherwise, @code{type} is assumed to be `@code{c}', which references
|
||||
a classification.
|
||||
-->
|
||||
<function name="lvp:pred-parse" as="xs:string+">
|
||||
<param name="pred" as="xs:string" />
|
||||
|
||||
<variable name="is-special" as="xs:boolean"
|
||||
select="substring-after( $pred, ':' ) != ''" />
|
||||
|
||||
<sequence select="if ( $is-special ) then
|
||||
( substring-before( $pred, ':' ),
|
||||
substring-after( $pred, ':' ) )
|
||||
else
|
||||
( 'c',
|
||||
$pred )" />
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Recursively expands predicates into @code{lvp:predicate} nodes.
|
||||
-->
|
||||
<function name="lvp:expand-preds" as="element( lvp:predicate )*">
|
||||
<param name="seq" as="xs:string*" />
|
||||
<param name="context" as="element()" />
|
||||
|
||||
<if test="exists( $seq )">
|
||||
<variable name="cur-pred" as="xs:string"
|
||||
select="$seq[ 1 ]" />
|
||||
<variable name="parts" as="xs:string+"
|
||||
select="lvp:pred-parse( $cur-pred )" />
|
||||
|
||||
<variable name="type" as="xs:string"
|
||||
select="$parts[ 1 ]" />
|
||||
<variable name="ref" as="xs:string"
|
||||
select="$parts[ 2 ]" />
|
||||
|
||||
<lvp:predicate type="{$type}"
|
||||
ref="{$ref}"
|
||||
name="{$cur-pred}" />
|
||||
|
||||
<sequence select="lvp:expand-preds(
|
||||
subsequence( $seq, 2 ),
|
||||
$context )" />
|
||||
</if>
|
||||
</function>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,320 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Collapse table group
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group[@style='collapsetable']"
|
||||
mode="group-select"
|
||||
priority="2">
|
||||
|
||||
<xsl:variable name="self" select="." />
|
||||
|
||||
<xsl:variable name="tableTitle" select="lv:prop[@name='tableTitle']" />
|
||||
<xsl:variable name="columns" select="lv:prop[@name='columns']" />
|
||||
<xsl:variable name="subcolumns" select="lv:prop[@name='subcolumns']" />
|
||||
<xsl:variable name="prefixes" select="lv:prop[@name='prefixes']" />
|
||||
<xsl:variable name="columnSuffix" select="lv:prop[@name='columnSuffix']" />
|
||||
<xsl:variable name="blockFlag" select="lv:prop[@name='blockFlag']" />
|
||||
<xsl:variable name="blockDisplay" select="lv:prop[@name='blockDisplay']" />
|
||||
<xsl:variable name="blockFlagSummary" select="lv:prop[@name='blockFlagSummary']" />
|
||||
<xsl:variable name="columnClasses" select="lv:prop[@name='columnClasses']" />
|
||||
<xsl:variable name="colclass" select="tokenize( $columnClasses, ',' )" />
|
||||
<xsl:variable name="use_footer" select="if ( lv:prop[@name='useFooter'] = 'true' ) then true() else false()" />
|
||||
|
||||
<xsl:variable name="colcount">
|
||||
<xsl:if test="$debug or not( $subcolumns )">1</xsl:if>
|
||||
<xsl:if test="not( $debug ) and $subcolumns">
|
||||
<xsl:value-of select="count( tokenize( $subcolumns, ',' ) )" />
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<table>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>groupTable collapseTable</xsl:text>
|
||||
<xsl:if test="@locked">
|
||||
<xsl:text> locked</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<thead>
|
||||
<tr class="groupTableHead">
|
||||
<th class="groupTableSide">
|
||||
<xsl:if test="$subcolumns">
|
||||
<xsl:attribute name="rowspan">2</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="$tableTitle" />
|
||||
</th>
|
||||
<xsl:for-each select="tokenize( $columns, ',' )">
|
||||
<xsl:variable name="colpos" select="position()" />
|
||||
|
||||
<th>
|
||||
<xsl:attribute name="columnIndex" select="$colpos - 1" />
|
||||
|
||||
<xsl:if test="$subcolumns and not( $debug )">
|
||||
<xsl:attribute name="colspan">
|
||||
<xsl:value-of select="count( tokenize( $subcolumns, ',' ) )" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="class" select="$colclass[ $colpos ]" />
|
||||
|
||||
<!-- the actual text, wrapped in a div tag to make it easily
|
||||
selectable and stylable with CSS -->
|
||||
<div>
|
||||
<xsl:value-of select="." />
|
||||
|
||||
<!-- place header contents -->
|
||||
<xsl:for-each select="$self/lv:set[ @header='true' ]">
|
||||
<xsl:variable name="set" select="." />
|
||||
|
||||
<div class="header-content">
|
||||
<xsl:variable name="cols" select="tokenize( @each, ' ' )" />
|
||||
<xsl:variable name="prefix" select="$cols[ $colpos ]" />
|
||||
|
||||
<xsl:apply-templates select="$set">
|
||||
<!-- set the prefix on the element -->
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</th>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
|
||||
<xsl:if test="$subcolumns">
|
||||
<tr class="groupTableSubHead">
|
||||
<xsl:for-each select="tokenize( $columns, ',' )">
|
||||
<xsl:variable name="colpos" select="position()" />
|
||||
<!-- for debug (and XSLT 1.0 ) -->
|
||||
<xsl:if test="$debug">
|
||||
<th><xsl:value-of select="$subcolumns" /></th>
|
||||
</xsl:if>
|
||||
|
||||
<!-- actually generate the subcolumns if not debug mode -->
|
||||
<xsl:if test="not( $debug )">
|
||||
<xsl:for-each select="tokenize( $subcolumns, ',' )">
|
||||
<th>
|
||||
<xsl:attribute name="columnIndex" select="$colpos - 1" />
|
||||
<xsl:attribute name="class" select="$colclass[ $colpos ]" />
|
||||
<xsl:value-of select="." />
|
||||
</th>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- will be parsed client-side -->
|
||||
<xsl:attribute name="blockFlags" select="$blockFlag" />
|
||||
<xsl:attribute name="blockFlagSummary" select="$blockFlagSummary" />
|
||||
|
||||
<!-- process each set -->
|
||||
<xsl:for-each select="lv:set[ not( @header ) ]">
|
||||
<xsl:variable name="node" select="." />
|
||||
|
||||
<!-- processed (non-debug, XSLT 2.0) output -->
|
||||
<xsl:if test="not( $debug )">
|
||||
<!-- output the side column as the first cell -->
|
||||
<xsl:if test="position() gt 1">
|
||||
<xsl:text disable-output-escaping="yes"></tr></xsl:text>
|
||||
<xsl:if test="not( $use_footer ) or ( position() lt last() )">
|
||||
<xsl:text disable-output-escaping="yes"><tr class="</xsl:text>
|
||||
|
||||
<xsl:if test="position() mod 2 != 1">
|
||||
<!-- alternate class for zebra striping -->
|
||||
<xsl:text disable-output-escaping="yes">alt </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$use_footer and ( position() = last() )">
|
||||
<!-- mark as footer -->
|
||||
<xsl:text disable-output-escaping="yes">footer </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$self/lv:set[ @class ]">
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text disable-output-escaping="yes">"></xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:if>
|
||||
|
||||
<!-- the first row (the parent row) will consume the first set -->
|
||||
<xsl:if test="position() = 1">
|
||||
<xsl:text disable-output-escaping="yes"><tr class="unit"></xsl:text>
|
||||
<td class="groupTableSide">
|
||||
<xsl:value-of select="../@prefix" />
|
||||
<span class="rowindex"></span>
|
||||
|
||||
<xsl:if test="$columnSuffix">
|
||||
<xsl:apply-templates select="$columnSuffix" />
|
||||
</xsl:if>
|
||||
</td>
|
||||
</xsl:if>
|
||||
|
||||
<!-- side column -->
|
||||
<xsl:if test="position() gt 1">
|
||||
<td class="groupTableSide">
|
||||
<xsl:variable name="ref" select="*[1]/@ref" />
|
||||
<xsl:variable name="label" select="*[1]/@label" />
|
||||
<xsl:if test="$label">
|
||||
<xsl:value-of select="$label" />
|
||||
</xsl:if>
|
||||
<xsl:if test="not( $label ) and $ref">
|
||||
<xsl:value-of select="//lv:question[@id=$ref]/@label" />
|
||||
</xsl:if>
|
||||
</td>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:for-each select="tokenize( @each, ' ' )">
|
||||
<xsl:variable name="i" select="position()" />
|
||||
<xsl:variable name="prefix" select="." />
|
||||
<xsl:variable name="matches"
|
||||
select="$node/lv:question | $node/lv:answer | $node/lv:display | $node/lv:static | $node/lv:question-copy" />
|
||||
<xsl:variable name="maxi" select="count( $matches )" />
|
||||
|
||||
<xsl:for-each select="$matches">
|
||||
<xsl:variable name="subi" select="position()" />
|
||||
|
||||
<!-- processed (non-debug, XSLT 2.0) output -->
|
||||
<xsl:if test="not( $debug )">
|
||||
<!-- output element -->
|
||||
<td>
|
||||
<!-- apply class to this element as well to permit proper
|
||||
styling (e.g. text centering) -->
|
||||
<xsl:attribute name="class">
|
||||
<xsl:if test="@type">
|
||||
<xsl:value-of select="@type" />
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="string-length( @class ) > 0">
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
|
||||
<!-- used for sectioning (CSS) -->
|
||||
<xsl:if test="$subi = 1">
|
||||
<xsl:text> columnLeft</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$subi = $maxi">
|
||||
<xsl:text> columnRight</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$colclass[ $i ]" />
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- output the column it is a part of for quick reference
|
||||
(convert to 0-index) -->
|
||||
<xsl:attribute name="columnIndex" select="$i - 1" />
|
||||
<xsl:attribute name="subColumnIndex" select="$subi - 1" />
|
||||
|
||||
<xsl:apply-templates select=".">
|
||||
<!-- set the prefix on the element -->
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:apply-templates>
|
||||
</td>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
<xsl:text disable-output-escaping="yes"></tr></xsl:text>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Block display divs host the content that will be rendered in
|
||||
block display mode for each respective column. The fallback to
|
||||
blockFlag is for backwards-compatibility. -->
|
||||
<xsl:sequence select="lv:gen-block-display(
|
||||
if ( $blockDisplay ) then
|
||||
$blockDisplay
|
||||
else
|
||||
$blockFlag )" />
|
||||
|
||||
<xsl:if test="not( $debug )">
|
||||
<div class="addrow">Add Row</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Render block display.
|
||||
|
||||
The new display format supports anything that a static element
|
||||
does. To maintain backwards-compatibility, we guess whether the old
|
||||
style is being used by determining if there is only a single
|
||||
property with no child elements.
|
||||
-->
|
||||
<xsl:function name="lv:gen-block-display">
|
||||
<xsl:param name="block-display" as="element()*" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="count( $block-display ) = 1
|
||||
and not( $block-display/element() )">
|
||||
<xsl:sequence select="lv:gen-block-display-old( $block-display )" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:for-each select="$block-display">
|
||||
<div id="block_display_{generate-id(.)}"
|
||||
class="block-display">
|
||||
<xsl:apply-templates mode="generate-static"
|
||||
select="." />
|
||||
</div>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:function>
|
||||
|
||||
|
||||
<!--
|
||||
Backwards-compatibility with legacy blockDisplay property.
|
||||
|
||||
The old format contained a comma-delimited (no whitespace) list of
|
||||
refs to display as the block value for each respective column. We
|
||||
simply convert it into a property with a single display element and
|
||||
pass it back off for rendering.
|
||||
-->
|
||||
<xsl:function name="lv:gen-block-display-old">
|
||||
<xsl:param name="block-display" as="element()" />
|
||||
|
||||
<xsl:for-each select="tokenize( $block-display, ',' )">
|
||||
<xsl:variable name="gen-block" as="element( lv:prop )">
|
||||
<lv:prop name="blockDisplay">
|
||||
<lv:display ref="{.}" allow-html="true" />
|
||||
</lv:prop>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:sequence select="lv:gen-block-display( $gen-block )" />
|
||||
</xsl:for-each>
|
||||
</xsl:function>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Default group (a simple list of questions)
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group"
|
||||
name="group-default"
|
||||
mode="group-select"
|
||||
priority="1">
|
||||
|
||||
<dl>
|
||||
<!-- misc. styles will just be applied as classes -->
|
||||
<xsl:if test="@style">
|
||||
<xsl:attribute name="class" select="@style" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates mode="generate"/>
|
||||
</dl>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Group HTML generation
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<!-- supported styles -->
|
||||
<xsl:include href="default.xsl"/>
|
||||
<xsl:include href="table.xsl"/>
|
||||
<xsl:include href="sidetable.xsl"/>
|
||||
<xsl:include href="collapsetable.xsl"/>
|
||||
<xsl:include href="tabbed.xsl"/>
|
||||
<xsl:include href="tabbedblock.xsl"/>
|
||||
|
||||
<xsl:template name="group-id">
|
||||
<xsl:text>group_</xsl:text>
|
||||
<xsl:if test="@id">
|
||||
<xsl:value-of select="@id"/>
|
||||
</xsl:if>
|
||||
<!-- if no id was given, generate one -->
|
||||
<xsl:if test="not(@id)">
|
||||
<xsl:value-of select="generate-id(.)" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group">
|
||||
<fieldset class="stepGroup {@style} {@class}">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="group-id" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:if test="@title">
|
||||
<legend><span><xsl:value-of select="@title"/></span></legend>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates select="." mode="group-select" />
|
||||
</fieldset>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:prop" mode="generate">
|
||||
<!-- do nothing -->
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Side-table group
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group[@style='sidetable']"
|
||||
mode="group-select"
|
||||
priority="2">
|
||||
|
||||
<xsl:variable name="tableTitle" select="lv:prop[@name='tableTitle']" />
|
||||
<xsl:variable name="columns" select="lv:prop[@name='columns']" />
|
||||
<xsl:variable name="columnSuffix" select="lv:prop[@name='columnSuffix']" />
|
||||
<xsl:variable name="staticHead" select="lv:prop[@name='staticHead']" />
|
||||
<xsl:variable name="columnClasses" select="lv:prop[@name='columnClasses']" />
|
||||
<xsl:variable name="colclass" select="tokenize( $columnClasses, ',' )" />
|
||||
|
||||
<xsl:variable name="colcount">
|
||||
<xsl:if test="$debug or not( $columns )">1</xsl:if>
|
||||
<xsl:if test="not( $debug ) and $columns">
|
||||
<xsl:value-of select="count( tokenize( $columns, ',' ) )" />
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
|
||||
<table>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>groupTable</xsl:text>
|
||||
<xsl:if test="@locked">
|
||||
<xsl:text> locked</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="groupTableSide">
|
||||
<xsl:if test="$columns">
|
||||
<xsl:attribute name="rowspan">2</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="$tableTitle" />
|
||||
</th>
|
||||
<th>
|
||||
<xsl:if test="$columns and not( $debug )">
|
||||
<xsl:attribute name="colspan">
|
||||
<xsl:value-of select="count( tokenize( $columns, ',' ) )" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="@prefix" />
|
||||
|
||||
<!-- if static text was given for the head, we don't want to display
|
||||
an index -->
|
||||
<xsl:if test="$staticHead">
|
||||
<xsl:value-of select="$staticHead" />
|
||||
</xsl:if>
|
||||
<xsl:if test="not( $staticHead )">
|
||||
<span class="colindex"></span>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$columnSuffix">
|
||||
<xsl:apply-templates select="$columnSuffix" />
|
||||
</xsl:if>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<xsl:if test="$columns">
|
||||
<tr>
|
||||
<!-- for debug (and XSLT 1.0 ) -->
|
||||
<xsl:if test="$debug">
|
||||
<th><xsl:value-of select="$columns" /></th>
|
||||
</xsl:if>
|
||||
|
||||
<!-- actually generate the columns if not debug mode -->
|
||||
<xsl:if test="not( $debug )">
|
||||
<xsl:for-each select="tokenize( $columns, ',' )">
|
||||
<xsl:variable name="i" select="position()" />
|
||||
<th>
|
||||
<xsl:attribute name="columnIndex" select="$i - 1" />
|
||||
<xsl:attribute name="class" select="$colclass[ $i ]" />
|
||||
<xsl:value-of select="." />
|
||||
</th>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<xsl:for-each select="lv:question | lv:answer | lv:display | lv:static | lv:question-copy">
|
||||
<xsl:variable name="i" select="position()" />
|
||||
|
||||
<!-- output the side column as the first cell -->
|
||||
<xsl:if test="( position() - 1 ) mod $colcount = 0">
|
||||
<xsl:if test="position() gt 1">
|
||||
<xsl:text disable-output-escaping="yes"></tr></xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text disable-output-escaping="yes"><tr></xsl:text>
|
||||
|
||||
<!-- side column -->
|
||||
<td class="groupTableSide">
|
||||
<xsl:if test="@ref and not( @label )">
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:value-of select="//lv:question[@id=$ref]/@label" />
|
||||
</xsl:if>
|
||||
<xsl:if test="not( @ref ) or @label">
|
||||
<xsl:value-of select="@label" />
|
||||
</xsl:if>
|
||||
</td>
|
||||
</xsl:if>
|
||||
|
||||
<!-- output element -->
|
||||
<td>
|
||||
<xsl:attribute name="columnIndex" select="$i - 1" />
|
||||
<xsl:attribute name="class" select="$colclass[ $i ]" />
|
||||
|
||||
<xsl:if test="not(name() = 'lv:static')">
|
||||
<xsl:apply-templates select="." />
|
||||
</xsl:if>
|
||||
<xsl:if test="name() = 'lv:static'">
|
||||
<xsl:copy-of select="." />
|
||||
</xsl:if>
|
||||
</td>
|
||||
</xsl:for-each>
|
||||
<xsl:text disable-output-escaping="yes"></tr></xsl:text>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<xsl:if test="not( $debug )">
|
||||
<div class="addrow">Add Row</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Tabbed group
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group[@style='tabbed']"
|
||||
mode="group-select"
|
||||
priority="2">
|
||||
|
||||
<div class="groupTabs">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>groupTabs</xsl:text>
|
||||
<xsl:if test="@locked">
|
||||
<xsl:text> locked</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#group_tab_{@id}">
|
||||
<xsl:value-of select="@prefix" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="group_tab_{@id}">
|
||||
<xsl:call-template name="group-default" />
|
||||
<br class="tabClear" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<xsl:if test="not( $debug )">
|
||||
<div class="addTab">Add <xsl:value-of select="@prefix" /></div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Block tabbed group
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:group[@style='tabbedblock']"
|
||||
mode="group-select"
|
||||
priority="2">
|
||||
|
||||
<xsl:variable name="logo" select="lv:prop[@name='logo']" />
|
||||
<xsl:variable name="tabTitle" select="lv:prop[@name='tabTitle']" />
|
||||
<xsl:variable name="supplier" select="lv:prop[@name='supplier']" />
|
||||
<xsl:variable name="lengthField" select="lv:prop[@name='lengthField']" />
|
||||
|
||||
<xsl:variable name="tabextract-src" select="lv:prop[@name='tabextractSrc']" />
|
||||
<xsl:variable name="tabextract-dest" select="lv:prop[@name='tabextractDest']" />
|
||||
|
||||
<xsl:variable name="disableFlags">
|
||||
<xsl:for-each select="lv:prop[@name='disableFlag']">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>;</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="." />
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
<div data-disable-flags="{$disableFlags}"
|
||||
data-tabextract-src="{$tabextract-src}"
|
||||
data-tabextract-dest="{$tabextract-dest}"
|
||||
data-length-field="{$lengthField}">
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>groupTabbedBlock</xsl:text>
|
||||
|
||||
<xsl:if test="@locked='true'">
|
||||
<xsl:text> locked</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<img class="raterLogo">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:apply-templates select="$logo" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:apply-templates select="$supplier"/>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
|
||||
<!-- tab selection -->
|
||||
<div class="tabs">
|
||||
<ul class="tabs">
|
||||
<li>
|
||||
<a href="#group_tab_{@id}">
|
||||
<xsl:apply-templates select="$tabTitle" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- tab content -->
|
||||
<div id="group_tab_{@id}" class="tab-content">
|
||||
<!-- generate default content; we're simply enclosing an otherwise
|
||||
"normal" group into a tabbed environment -->
|
||||
<xsl:call-template name="group-default" />
|
||||
<xsl:if test="@compare">
|
||||
<div class="compareOptions navbtns">
|
||||
<input type="checkbox" >
|
||||
<xsl:attribute name="value" select="$supplier" />
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>compareOption</xsl:text>
|
||||
</xsl:attribute>
|
||||
</input><span>Compare</span>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:for-each select="lv:prop[@name='button']">
|
||||
<input type="button" >
|
||||
<xsl:attribute name="name" select="$supplier" />
|
||||
<xsl:attribute name="value" select="." />
|
||||
<xsl:if test="@class">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</input>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
|
||||
<br class="tabClear" />
|
||||
</div>
|
||||
|
||||
<!-- permits adding tabs (this may be hidden by the group if it is locked, but
|
||||
we still want to output it in case it needs to be shown) -->
|
||||
<div class="addTab">
|
||||
<xsl:text>Add </xsl:text>
|
||||
<xsl:value-of select="@prefix" />
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Table group
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group[@style='table']"
|
||||
mode="group-select"
|
||||
priority="2">
|
||||
|
||||
<!-- allows rows to be locked after they are added (so that they cannot be
|
||||
modified), but allows new rows to still be added -->
|
||||
<xsl:variable name="rowlock" select="lv:prop[@name='rowlock']" />
|
||||
|
||||
<table>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>groupTable</xsl:text>
|
||||
<xsl:if test="@locked">
|
||||
<xsl:text> locked</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$rowlock">
|
||||
<xsl:text> rowlock</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
<thead>
|
||||
<xsl:for-each select="lv:question|lv:question-copy|lv:answer|lv:display">
|
||||
<th id="qhead_{@id}">
|
||||
<!-- if in debug, add an anchor to easily locate questions -->
|
||||
<xsl:if test="$debug and @id">
|
||||
<xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
|
||||
<a name="_{@id}"/>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@hidden = true()">
|
||||
<xsl:attribute name="class">hidden</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- @label overrides ref label -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@label">
|
||||
<xsl:value-of select="@label" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:value-of select="//lv:question[@id=$ref]/@label" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</th>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="not( $rowlock = 'true' )">
|
||||
<th class="delrow">Remove</th>
|
||||
</xsl:if>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<xsl:for-each select="lv:question|lv:question-copy|lv:answer|lv:display">
|
||||
<xsl:variable name="i" select="position()" />
|
||||
|
||||
<td>
|
||||
<xsl:attribute name="data-contained-field-name" select="@id" />
|
||||
|
||||
<xsl:attribute name="columnIndex" select="$i - 1" />
|
||||
|
||||
<!-- add question id as tooltip for debugging purposes -->
|
||||
<xsl:if test="$debug and @id">
|
||||
<xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@hidden = true()">
|
||||
<xsl:attribute name="class">hidden</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates select="." />
|
||||
</td>
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:if test="not( $rowlock = 'true' )">
|
||||
<td class="delrow"> </td>
|
||||
</xsl:if>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<xsl:if test="not( $debug )">
|
||||
<div class="addrow">Add <xsl:value-of select="@prefix" /></div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Builds JSON-formatted question type metadata
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:qtype="http://www.lovullo.com/program/ui/meta/qtypes"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
|
||||
<template mode="qtype:parse-element" priority="5" as="xs:string*"
|
||||
match="lv:question
|
||||
|lv:question/lv:option
|
||||
|lv:display
|
||||
|lv:external">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<!-- ids may be generated for elements that use @ref, so have @ref
|
||||
take precedence -->
|
||||
<variable name="id"
|
||||
select="if ( @ref ) then @ref else @id" />
|
||||
<variable name="type"
|
||||
select="qtype:parse-type( @type )" />
|
||||
<variable name="dim"
|
||||
select="if ( @dim ) then @dim else 1" />
|
||||
|
||||
|
||||
<choose>
|
||||
<when test="ancestor::lv:set">
|
||||
<variable name="id"
|
||||
select="if ( @ref ) then @ref else @id" />
|
||||
|
||||
<sequence select="qtype:process-set(
|
||||
$id,
|
||||
$type,
|
||||
$dim,
|
||||
ancestor::lv:set )" />
|
||||
</when>
|
||||
|
||||
<otherwise>
|
||||
<sequence select="qtype:gen-type( $id, $type, $dim )" />
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
|
||||
<template mode="qtype:parse-element" priority="4" as="xs:string*"
|
||||
match="lv:set">
|
||||
<apply-templates mode="qtype:parse-element" />
|
||||
</template>
|
||||
|
||||
|
||||
<template mode="qtype:parse-element" priority="1" as="xs:string?"
|
||||
match="node()">
|
||||
<!-- nothing -->
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
Determine type from the given string @var{type}. Currently, the
|
||||
expression is either the provided string or @t{'undefined'}.
|
||||
-->
|
||||
<function name="qtype:parse-type" as="xs:string">
|
||||
<param name="type" as="xs:string?" />
|
||||
|
||||
<sequence select="if ( exists( $type )
|
||||
and not( $type = '' ) ) then
|
||||
$type
|
||||
else
|
||||
'undefined'" />
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Compile type information for sets. @t{$set/@each} should be a
|
||||
space-delimited string of prefixes for the containing elements; one
|
||||
element per prefix will be generated.
|
||||
-->
|
||||
<function name="qtype:process-set" as="xs:string*">
|
||||
<param name="id" as="xs:string" />
|
||||
<param name="type" as="xs:string" />
|
||||
<param name="dim" as="xs:integer" />
|
||||
<param name="set" as="element( lv:set )" />
|
||||
|
||||
<for-each select="tokenize( $set/@each, ' ' )">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<sequence select="qtype:gen-type(
|
||||
concat( ., '_', $id ),
|
||||
$type,
|
||||
$dim )" />
|
||||
</for-each>
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Generate key-value JSON pair for a one-dimensional identifier.
|
||||
|
||||
The output is expected to be used as part of an object literal.
|
||||
-->
|
||||
<function name="qtype:gen-type" as="xs:string">
|
||||
<param name="id" as="xs:string" />
|
||||
<param name="type" as="xs:string" />
|
||||
|
||||
<sequence select="qtype:gen-type( $id, $type, 1 )" />
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Generate key-value JSON pair for an identifier.
|
||||
|
||||
The output is expected to be used as part of an object literal.
|
||||
-->
|
||||
<function name="qtype:gen-type" as="xs:string">
|
||||
<param name="id" as="xs:string" />
|
||||
<param name="type" as="xs:string" />
|
||||
<param name="dim" as="xs:integer" />
|
||||
|
||||
<sequence select="concat(
|
||||
'''',
|
||||
$id,
|
||||
''':{',
|
||||
'type:''', $type,
|
||||
''',',
|
||||
'dim:', $dim,
|
||||
'}' )" />
|
||||
</function>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Builds JSON-formatted program metadata
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:qtype="http://www.lovullo.com/program/ui/meta/qtypes"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<output method="text"
|
||||
indent="yes"
|
||||
omit-xml-declaration="yes"
|
||||
/>
|
||||
|
||||
<include href="meta/qtypes.xsl" />
|
||||
|
||||
|
||||
<template name="build-meta">
|
||||
<text>{qtypes:{</text>
|
||||
<!-- XXX: qtype:parse-element doesn't accept lv:answer; research! -->
|
||||
<apply-templates mode="qtype:parse-element"
|
||||
select="//lv:question,
|
||||
//lv:question/lv:option[ @id ],
|
||||
//lv:answer,
|
||||
//lv:display[@type],
|
||||
//lv:external" />
|
||||
|
||||
<text>},qdata:{</text>
|
||||
<apply-templates select="//lv:question[@type='select']" mode="meta-qdata" />
|
||||
|
||||
<text>},arefs:{</text>
|
||||
<apply-templates select="//lv:answer|//lv:display" mode="meta-aref" />
|
||||
|
||||
<text>},groups:{</text>
|
||||
<apply-templates select="//lv:group[@style]" mode="meta" />
|
||||
<text>}}</text>
|
||||
</template>
|
||||
|
||||
|
||||
<template match="//lv:question" mode="meta-qdata">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<text></text>
|
||||
<value-of select="@id" />
|
||||
<text>:{</text>
|
||||
|
||||
<!-- add each of the options -->
|
||||
<for-each select="lv:option">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<text>'</text>
|
||||
<value-of select="replace( @value, "'", "\\'" )" />
|
||||
<text>':'</text>
|
||||
<value-of select="normalize-space( . )" />
|
||||
<text>'</text>
|
||||
</for-each>
|
||||
|
||||
<text>}</text>
|
||||
</template>
|
||||
|
||||
|
||||
<template match="lv:answer|lv:display" mode="meta-aref">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<text>'</text>
|
||||
<value-of select="@id" />
|
||||
<text>':'</text>
|
||||
<value-of select="@ref" />
|
||||
<text>'</text>
|
||||
</template>
|
||||
|
||||
|
||||
<template match="//lv:group" mode="meta">
|
||||
<if test="position() > 1">
|
||||
<text>,</text>
|
||||
</if>
|
||||
|
||||
<text>"</text>
|
||||
<value-of select="@id" />
|
||||
<text>":{max:</text>
|
||||
<value-of select="if ( @maxRows ) then number( @maxRows ) else '0'" />
|
||||
<text>,min:</text>
|
||||
<value-of select="if ( @minRows ) then number( @minRows ) else '0'" />
|
||||
<text>}</text>
|
||||
</template>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Generates code for calculated values
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com"
|
||||
xmlns:assert="http://www.lovullo.com/assert">
|
||||
|
||||
<xsl:output
|
||||
method="text"
|
||||
indent="yes"
|
||||
omit-xml-declaration="yes"
|
||||
/>
|
||||
|
||||
|
||||
<!--
|
||||
Generates code for calculating values
|
||||
-->
|
||||
<xsl:template match="lv:calc" mode="gen-calc">
|
||||
<xsl:param name="deps" select="false()" />
|
||||
<xsl:param name="children" select="false()" />
|
||||
<xsl:param name="with-diff" select="true()" />
|
||||
<xsl:param name="method" select="'overwriteValues'" />
|
||||
|
||||
<xsl:variable name="id" select="@id" />
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:variable name="value" select="@value" />
|
||||
|
||||
<!-- if we're to handle dependencies, parse them first (recursive) -->
|
||||
<xsl:if test="$deps = true()">
|
||||
<xsl:apply-templates select="//lv:calc[ @id=$ref or @id=$value ]" mode="gen-calc">
|
||||
<xsl:with-param name="deps" select="true()" />
|
||||
<xsl:with-param name="with-diff" select="$with-diff" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
|
||||
<!-- recursively search for dependencies (note that we use merge-diff rather
|
||||
than simply ignoring the diff entirely because we do not want to trigger
|
||||
delayed merging; see DelayedStagingBucket) -->
|
||||
<xsl:text>bucket.</xsl:text>
|
||||
<xsl:value-of select="$method" />
|
||||
<xsl:text>({</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>:Calc['</xsl:text>
|
||||
<xsl:value-of select="@method" />
|
||||
<xsl:text>']</xsl:text>
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:call-template name="parse-expected">
|
||||
<xsl:with-param name="expected" select="@ref" />
|
||||
<xsl:with-param name="merge-diff" select="$with-diff" />
|
||||
</xsl:call-template>
|
||||
<xsl:text>,</xsl:text>
|
||||
<xsl:call-template name="parse-expected">
|
||||
<xsl:with-param name="expected" select="@value" />
|
||||
<xsl:with-param name="merge-diff" select="$with-diff" />
|
||||
</xsl:call-template>
|
||||
<xsl:text>)});</xsl:text>
|
||||
|
||||
<!-- any that depend on us? -->
|
||||
<xsl:if test="$children = true()">
|
||||
<xsl:apply-templates select="//lv:calc[ @ref=$id or @value=$id ]" mode="gen-calc">
|
||||
<xsl:with-param name="children" select="true()" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,720 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Builds the data API data structures to be included in the Program class
|
||||
for a given program
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
AN XSLT 2.0 PARSER IS REQUIRED TO PROCESS THIS STYLESHEET!
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lv="http://www.lovullo.com"
|
||||
xmlns:compiler="http://www.lovullo.com/program/compiler"
|
||||
xmlns:assert="http://www.lovullo.com/assert">
|
||||
|
||||
<xsl:output
|
||||
method="text"
|
||||
indent="yes"
|
||||
omit-xml-declaration="yes"
|
||||
/>
|
||||
|
||||
|
||||
<!--
|
||||
Constructs an object literal containing object-literal definitions of each
|
||||
API, indexed by API id
|
||||
-->
|
||||
<xsl:template match="lv:program" mode="compiler:compile-apis">
|
||||
<xsl:text>{</xsl:text>
|
||||
<xsl:for-each select="./lv:api">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>':</xsl:text>
|
||||
|
||||
<xsl:apply-templates select="." mode="compiler:compile" />
|
||||
</xsl:for-each>
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:program" mode="compiler:compile-question-apis">
|
||||
<xsl:text>{</xsl:text>
|
||||
<xsl:for-each select="//lv:question[ lv:data ]">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="concat( '''',
|
||||
@id,
|
||||
''':''',
|
||||
lv:data/@source,
|
||||
'''' )" />
|
||||
</xsl:for-each>
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
RESTful API definition
|
||||
|
||||
Much of this would be common to any type of API, so this can be refactored
|
||||
if/when other types are added.
|
||||
|
||||
The generated code is an object literal describing the API.
|
||||
-->
|
||||
<xsl:template match="lv:api[@type='rest' or @type='local']" mode="compiler:compile" priority="5">
|
||||
<xsl:variable name="api" select="." />
|
||||
|
||||
<xsl:text>{</xsl:text>
|
||||
<!-- simply copy over the string values of each of these attributes -->
|
||||
<xsl:for-each select="('type', 'source', 'method')">
|
||||
<xsl:variable name="attr" select="." />
|
||||
|
||||
<xsl:value-of select="$attr" />
|
||||
<xsl:text>:'</xsl:text>
|
||||
<xsl:value-of select="$api/@*[ local-name() = $attr ]" />
|
||||
<xsl:text>',</xsl:text>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- build params (to be sent to the service) -->
|
||||
<xsl:text>params:{</xsl:text>
|
||||
<xsl:for-each select="./lv:param">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="@name" />
|
||||
<xsl:text>':</xsl:text>
|
||||
|
||||
<!-- generate the param description -->
|
||||
<xsl:apply-templates select="." mode="compiler:compile" />
|
||||
</xsl:for-each>
|
||||
<xsl:text>},</xsl:text>
|
||||
|
||||
<!-- build an array of expected return values -->
|
||||
<xsl:text>retvals:[</xsl:text>
|
||||
<xsl:for-each select="./lv:returns/lv:param">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="@name" />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>],</xsl:text>
|
||||
|
||||
<!-- static values to prepend to the server response set -->
|
||||
<xsl:text>'static':[</xsl:text>
|
||||
<xsl:for-each select="./lv:returns/lv:static/lv:item">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>{</xsl:text>
|
||||
<xsl:apply-templates select="." mode="compiler:compile" />
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>],</xsl:text>
|
||||
|
||||
<xsl:text>static_nonempty:</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="./lv:returns/lv:static/@nonempty = 'true'">
|
||||
<xsl:text>true</xsl:text>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:text>false</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:text>,</xsl:text>
|
||||
|
||||
<xsl:text>static_multiple:</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="./lv:returns/lv:static/@multiple = 'true'">
|
||||
<xsl:text>true</xsl:text>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:text>false</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Generates an object literal describing a particular API parameter
|
||||
|
||||
Params can have default values that are either strings or references to
|
||||
bucket values; the distinction is made via a "type" field.
|
||||
|
||||
All single quotes are stripped, even if they are within the middle of a
|
||||
string. This has the consequence of both removing single quotes for string
|
||||
literals and preventing the user from terminating the string (code injection,
|
||||
syntax errors more likely); if we need single quotes, that will have to be
|
||||
changed in the future. Changes are, single quotes will not be needed.
|
||||
-->
|
||||
<xsl:template match="lv:api/lv:param" mode="compiler:compile">
|
||||
<xsl:text>{</xsl:text>
|
||||
|
||||
<!-- param name -->
|
||||
<xsl:text>name:'</xsl:text>
|
||||
<xsl:value-of select="@name" />
|
||||
<xsl:text>',</xsl:text>
|
||||
|
||||
<!-- default value, if any (will default to an empty string -->
|
||||
<xsl:text>'default':{</xsl:text>
|
||||
<xsl:text>type:'</xsl:text>
|
||||
<xsl:choose>
|
||||
<!-- if the value starts with a single quote, then it is to be
|
||||
interpreted as a string instead of a bucket reference -->
|
||||
<xsl:when test="starts-with( @value, "'" )">
|
||||
<xsl:text>string</xsl:text>
|
||||
</xsl:when>
|
||||
|
||||
<!-- non-strings are considered to be bucket references -->
|
||||
<xsl:otherwise>
|
||||
<xsl:text>ref</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>',</xsl:text>
|
||||
|
||||
<xsl:text>value:'</xsl:text>
|
||||
<!-- remove single quotes, which may or may not be present -->
|
||||
<xsl:value-of select="translate( @value, "'", '' )" />
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:api/lv:returns/lv:static/lv:item" mode="compiler:compile">
|
||||
<xsl:for-each select="./lv:value">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="@param" />
|
||||
<xsl:text>':'</xsl:text>
|
||||
<!-- remove single quotes -->
|
||||
<xsl:value-of select="translate( ., "'", '' )" />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- unknown API type -->
|
||||
<xsl:template match="lv:api" mode="compiler:compile" priority="1">
|
||||
<compiler:error>
|
||||
<xsl:text>Unknown API type '</xsl:text>
|
||||
<xsl:value-of select="@type" />
|
||||
<xsl:text>'</xsl:text>
|
||||
</compiler:error>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Triggers API calls when dependency params change
|
||||
-->
|
||||
<xsl:template mode="post-parse-question-event"
|
||||
priority="5"
|
||||
match="lv:question[
|
||||
./lv:data
|
||||
or @id=//lv:data/@* ]">
|
||||
<xsl:param name="type" />
|
||||
<xsl:param name="id" />
|
||||
<xsl:param name="eventData" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$type = 'dapi'">
|
||||
<xsl:call-template name="compiler:dapi-event" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$type = 'change'">
|
||||
<xsl:sequence select="concat(
|
||||
$eventData,
|
||||
'.dapi[''', $id, ''']',
|
||||
'.apply( this, arguments ); ' )" />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="compiler:dapi-event">
|
||||
<xsl:variable name="id" select="@id" />
|
||||
<xsl:variable name="question" select="." />
|
||||
|
||||
<!-- are we used as a dependency for any other API calls? -->
|
||||
<xsl:variable name="depof" as="element( lv:question )*"
|
||||
select="//lv:question[ ./lv:data/@* = $id ]" />
|
||||
|
||||
<xsl:variable name="dapi-call" as="element( lv:data )+"
|
||||
select="if ( exists( $depof ) ) then
|
||||
$depof/lv:data
|
||||
else
|
||||
$question/lv:data" />
|
||||
|
||||
<!-- whether any questions we map _to_ request that their values be
|
||||
retained -->
|
||||
<xsl:variable name="has-retains" as="xs:boolean"
|
||||
select="exists( //lv:question[
|
||||
@id = $dapi-call/lv:map/@into
|
||||
and @retain = 'true'
|
||||
] )" />
|
||||
|
||||
<xsl:for-each select="$depof">
|
||||
<xsl:choose>
|
||||
<xsl:when test="lv:data/@source=//lv:api[ @combined='true' ]/@id">
|
||||
<!-- marker to help find this code in the compiled file -->
|
||||
<xsl:text>/*dapicall-combined*/</xsl:text>
|
||||
|
||||
<!-- we only care about the indexes that have actually changed -->
|
||||
<xsl:text>if(diff['</xsl:text>
|
||||
<xsl:value-of select="$id" />
|
||||
<xsl:text>']){</xsl:text>
|
||||
<!-- trigger the API call -->
|
||||
<xsl:apply-templates select="./lv:data" mode="compiler:api-trigger" />
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:when>
|
||||
|
||||
|
||||
<xsl:otherwise>
|
||||
<!-- marker to help find this code in the compiled file -->
|
||||
<xsl:text>/*dapicall*/</xsl:text>
|
||||
|
||||
<!-- we only care about the indexes that have actually changed -->
|
||||
<xsl:text>var diffdata=diff['</xsl:text>
|
||||
<xsl:value-of select="$id" />
|
||||
<xsl:text>'];</xsl:text>
|
||||
|
||||
<!-- we must make the API call for each index -->
|
||||
<!-- N.B. As a consequence of this, since diff should be {} on load (since
|
||||
nothing actually changed), this will not kick off on step load (see the change
|
||||
event for the question itself) -->
|
||||
<xsl:text>var cdata=bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="$id" />
|
||||
<xsl:text>');</xsl:text>
|
||||
<xsl:text>for(var i in (diffdata||cdata)){</xsl:text>
|
||||
<!-- if any destination field requests to retain its value
|
||||
when its predicate no longer matches, then there is no
|
||||
use in ignoring the predicate, since there's no value
|
||||
to clear when it becomes false if we don't make the
|
||||
call to begin with -->
|
||||
<xsl:if test="not( $has-retains )">
|
||||
<!-- if subject to a predicate, ensure that it is met -->
|
||||
<xsl:text>if(cmatch['</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>'] && +cmatch['</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>'].indexes[i] !== 1</xsl:text>
|
||||
<xsl:text> && !cmatch['</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>'].all) {</xsl:text>
|
||||
<xsl:text>this.dapiManager.fieldStale('</xsl:text>
|
||||
<xsl:value-of select="@id" />
|
||||
<xsl:text>',i); continue;</xsl:text>
|
||||
<xsl:text>};</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- ensure that i keeps its value throughout the life of the request -->
|
||||
<xsl:text>(function(i){</xsl:text>
|
||||
|
||||
<!-- trigger the API call -->
|
||||
<xsl:apply-templates select="./lv:data" mode="compiler:api-trigger">
|
||||
<xsl:with-param name="i" select="'i'" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<!-- self-executing closure for the index (otherwise the value would have
|
||||
changed before the request comes back, so we would always be dealing
|
||||
with the last index) -->
|
||||
<xsl:text>}).call(this,i);</xsl:text>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- compile any direct API calls, if any -->
|
||||
<xsl:apply-templates select="./lv:data" mode="compiler:compile" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Triggers the actual data API call.
|
||||
|
||||
This will attempt to retrieve data from the API. In the event that required
|
||||
params are missing, it will throw an exception, which this will interpret as
|
||||
"not enough data" and will clear the field and each of its mapped bucket
|
||||
values. Consequently, this means that erasing the value of a field that this
|
||||
depends on will cause this field to be cleared.
|
||||
-->
|
||||
<xsl:template match="lv:data" mode="compiler:api-trigger">
|
||||
<!-- the variable in the generated JS holding the index to operate on -->
|
||||
<xsl:param name="i" select="'-1'" />
|
||||
|
||||
<xsl:variable name="self" select="." />
|
||||
|
||||
<!-- id of the parent question -->
|
||||
<xsl:variable name="qid" select="../@id" />
|
||||
|
||||
<!-- grab a list of all the API call params -->
|
||||
<xsl:variable name="params"
|
||||
select="@*[ not( local-name()='source' ) ]" />
|
||||
|
||||
<!-- grab value and label mappings -->
|
||||
<xsl:variable name="value-map" select="./lv:value/@from" />
|
||||
<xsl:variable name="label-map">
|
||||
<xsl:choose>
|
||||
<!-- if a label map is given, use it -->
|
||||
<xsl:when test="./lv:label">
|
||||
<xsl:value-of select="./lv:label/@from" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- otherwise, default to the same value as the value map -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$value-map" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:text>var _self=this;</xsl:text>
|
||||
|
||||
<!-- this is where the magic happens -->
|
||||
<xsl:if test="$i = '-1'">
|
||||
<xsl:text>var i=-1;</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>(function(i){</xsl:text>
|
||||
<!-- default; TODO: we don't always need this -->
|
||||
<xsl:text>var cdata = [];</xsl:text>
|
||||
|
||||
<!-- do we have any restrictions on this API call? -->
|
||||
<xsl:for-each select="lv:unless-set">
|
||||
<!-- return immediately from the lambda if the value is already set -->
|
||||
<xsl:text>if(''+bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="@ref" />
|
||||
<xsl:text>')[i]!=='')return;</xsl:text>
|
||||
</xsl:for-each>
|
||||
|
||||
|
||||
<!-- prevents race conditions when triggering fieldLoading event -->
|
||||
<xsl:text>var doload=true;</xsl:text>
|
||||
|
||||
<!-- TODO: duplicated -->
|
||||
<xsl:text>var prediff=bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>');</xsl:text>
|
||||
|
||||
<xsl:text>this.dapiManager.getApiData('</xsl:text>
|
||||
<xsl:value-of select="@source" />
|
||||
<xsl:text>', {</xsl:text>
|
||||
|
||||
<!-- add each of the param lookups -->
|
||||
<xsl:for-each select="$params">
|
||||
<xsl:if test="position() > 1 ">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- the ref we need to look up for this param -->
|
||||
<xsl:variable name="ref" select="." />
|
||||
|
||||
<!-- get the name associated with this param -->
|
||||
<xsl:variable name="pname"
|
||||
select="$self/@*[ . = $ref ]/local-name()" />
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="$pname" />
|
||||
<xsl:text>': </xsl:text>
|
||||
|
||||
<xsl:variable name="bucket-data">
|
||||
<xsl:call-template name="parse-expected">
|
||||
<xsl:with-param name="expected" select="$ref" />
|
||||
<xsl:with-param name="with-diff" select="true()" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring( $ref, 1, 1 ) = "'"">
|
||||
<xsl:value-of select="$ref" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- -1 is the "combined" index -->
|
||||
<xsl:when test="$i = '-1'">
|
||||
<xsl:value-of select="$bucket-data" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$bucket-data" />
|
||||
<xsl:text>[</xsl:text>
|
||||
<xsl:value-of select="$i" />
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:text>},</xsl:text>
|
||||
|
||||
<!-- once the data is returned, populate the field -->
|
||||
<xsl:text>function(err,retdata){doload=false;_self.dapiManager.setFieldData('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',</xsl:text>
|
||||
<xsl:value-of select="$i" />
|
||||
<xsl:text>,retdata,'</xsl:text>
|
||||
<xsl:value-of select="$value-map" />
|
||||
<xsl:text>','</xsl:text>
|
||||
<xsl:value-of select="$label-map" />
|
||||
<xsl:text>',(prediff[i]===cdata[i]))},</xsl:text>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',i,bucket,function(e){</xsl:text>
|
||||
<!-- on failure -->
|
||||
<xsl:text>_self.dapiManager.clearPendingApiCall('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>_'+i);</xsl:text>
|
||||
|
||||
<xsl:text>_self.dapiManager.fieldNotReady('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',</xsl:text>
|
||||
<xsl:value-of select="$i" />
|
||||
<xsl:text>,bucket);</xsl:text>
|
||||
|
||||
<!-- end of getApiData() call -->
|
||||
<xsl:text>});</xsl:text>
|
||||
|
||||
<!-- kick off an event allowing the UI/etc to indicate that the field
|
||||
is loading (we must do this *after* the call to ensure that this
|
||||
is only kicked off if there is no error) -->
|
||||
<xsl:text>if(doload){</xsl:text>
|
||||
<xsl:text>this.emit('fieldLoading','</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',</xsl:text>
|
||||
<xsl:value-of select="$i" />
|
||||
<xsl:text>);</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
<!-- invoke lambda with i to ensure that the value does not change on us -->
|
||||
<xsl:text>}).call(this,i);</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:data" mode="compiler:gen-data-map">
|
||||
<xsl:for-each select="./lv:map">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text>'</xsl:text>
|
||||
<xsl:value-of select="@into" />
|
||||
<xsl:text>':'</xsl:text>
|
||||
<xsl:value-of select="@param" />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Handles param expansion when a field containing API data changes
|
||||
-->
|
||||
<xsl:template match="lv:question/lv:data" mode="compiler:compile">
|
||||
<!-- The change event is triggered on step load as well as the addition of
|
||||
any indexes, giving us the chance to initialize any API calls. This also
|
||||
allows us to initialize once on page load rather than once per param
|
||||
change event (which would be bad) -->
|
||||
<xsl:apply-templates select="." mode="compiler:compile-api-init" />
|
||||
|
||||
<!-- we only care about the indexes that have actually changed -->
|
||||
<xsl:text>var diffdata=diff['</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>']||</xsl:text>
|
||||
<!-- we need to update the values for each field -->
|
||||
<xsl:text>bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>');</xsl:text>
|
||||
|
||||
<xsl:text>var prediff=bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>');</xsl:text>
|
||||
|
||||
<!-- XXX: duplicate -->
|
||||
<xsl:variable name="label-map">
|
||||
<xsl:choose>
|
||||
<!-- if a label map is given, use it -->
|
||||
<xsl:when test="./lv:label">
|
||||
<xsl:value-of select="./lv:label/@from" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- otherwise, default to the same value as the value map -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="lv:value/@from" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:text>for(var i in diffdata){</xsl:text>
|
||||
<!-- null represents a removal -->
|
||||
<xsl:text>if(diffdata[i]===null){</xsl:text>
|
||||
<xsl:text>this.dapiManager.clearFieldData('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>',i, false);</xsl:text>
|
||||
<xsl:text>continue;</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<xsl:text>if(this.dapiManager.hasFieldData('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>',i)){</xsl:text>
|
||||
|
||||
<!-- if we have no diff date, then this is probably triggered as the result
|
||||
of visiting the step; ensure that we populate the field if necessary
|
||||
-->
|
||||
<xsl:text>var expand=(prediff[i]!==diffdata[i]);</xsl:text>
|
||||
<xsl:text>if(!diff['</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>']){</xsl:text>
|
||||
<xsl:text>expand=this.dapiManager.triggerFieldUpdate('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>',</xsl:text>
|
||||
<xsl:value-of select="'i'" />
|
||||
<xsl:text>,'</xsl:text>
|
||||
<xsl:value-of select="lv:value/@from" />
|
||||
<xsl:text>','</xsl:text>
|
||||
<xsl:value-of select="$label-map" />
|
||||
<xsl:text>',(cdata[i]===diffdata[i]));</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<!-- expand the data into the bucket (the last argument indicates that we
|
||||
can predictively set values knowing that the data for the value may
|
||||
become available in the near future) -->
|
||||
<xsl:text>if(expand)this.dapiManager.expandFieldData('</xsl:text>
|
||||
<xsl:value-of select="../@id" />
|
||||
<xsl:text>',i,bucket,{</xsl:text>
|
||||
<xsl:apply-templates select="." mode="compiler:gen-data-map" />
|
||||
<xsl:text>},true,diff);</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
If an API call has no arguments, then it must be populated immediately (since
|
||||
there are no other fields that could trigger its population)
|
||||
-->
|
||||
<xsl:template match="lv:question/lv:data" mode="compiler:compile-api-init">
|
||||
|
||||
<xsl:variable name="qid" select="../@id" />
|
||||
|
||||
<!-- marker to make it easier to find a section in the compiled code -->
|
||||
<xsl:text>/*dapiinit*/</xsl:text>
|
||||
|
||||
<!-- current bucket data -->
|
||||
<xsl:text>var cdata=diff['</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>']||bucket.getDataByName('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>');</xsl:text>
|
||||
|
||||
<xsl:choose>
|
||||
<!-- combined call -->
|
||||
<xsl:when test="@source=//lv:api[ @combined='true' ]/@id">
|
||||
<!-- if we already have the API data, then we need only populate this
|
||||
field -->
|
||||
<xsl:text>if(this.dapiManager.hasFieldData('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>')){</xsl:text>
|
||||
|
||||
<!-- XXX: duplicate -->
|
||||
<xsl:variable name="label-map">
|
||||
<xsl:choose>
|
||||
<!-- if a label map is given, use it -->
|
||||
<xsl:when test="./lv:label">
|
||||
<xsl:value-of select="./lv:label/@from" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- otherwise, default to the same value as the value map -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="lv:value/@from" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- populate only the indexes that have changed -->
|
||||
<xsl:text>var cdiff=diff['</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>'];</xsl:text>
|
||||
<xsl:text>for(var i in cdiff){</xsl:text>
|
||||
|
||||
<!-- do nothing if the data is unchanged -->
|
||||
<xsl:text>if(cdiff[i]||cdiff[i]===''){</xsl:text>
|
||||
|
||||
<xsl:text>this.dapiManager.triggerFieldUpdate('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',</xsl:text>
|
||||
<xsl:value-of select="'i'" />
|
||||
<xsl:text>,'</xsl:text>
|
||||
<xsl:value-of select="lv:value/@from" />
|
||||
<xsl:text>','</xsl:text>
|
||||
<xsl:value-of select="$label-map" />
|
||||
<xsl:text>',(cdata[i]===cdiff[i]));</xsl:text>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
|
||||
<!-- otherwise, we do not yet have any data; perform the API call -->
|
||||
<xsl:text>}else{</xsl:text>
|
||||
<xsl:apply-templates select="." mode="compiler:api-trigger" />
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:when>
|
||||
|
||||
<!-- per-index -->
|
||||
<xsl:otherwise>
|
||||
<!-- check each existing index -->
|
||||
<xsl:text>for(var i in cdata){</xsl:text>
|
||||
|
||||
<!-- populate the field if it does not yet have any data -->
|
||||
<xsl:text>if(!this.dapiManager.hasFieldData('</xsl:text>
|
||||
<xsl:value-of select="$qid" />
|
||||
<xsl:text>',i)){</xsl:text>
|
||||
|
||||
<!-- trigger the API call for this index -->
|
||||
<xsl:apply-templates select="." mode="compiler:api-trigger">
|
||||
<xsl:with-param name="i" select="'i'" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<xsl:text>}</xsl:text>
|
||||
<xsl:text>}</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,635 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The program XML preprocessor
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
TODO: Merge with expand.xsl
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com"
|
||||
xmlns:assert="http://www.lovullo.com/assert"
|
||||
xmlns:preproc="http://www.lovullo.com/program/preprocessor">
|
||||
|
||||
|
||||
<xsl:template match="lv:program[ not( @version ) ]" mode="preprocess">
|
||||
<!-- TODO: pass into stylesheet as a param -->
|
||||
<xsl:variable name="path" select="'../.version.xml'" />
|
||||
<xsl:variable name="version" select="document( $path, /lv:program )/*" />
|
||||
|
||||
<xsl:variable name="root">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- add version attribute -->
|
||||
<xsl:attribute name="version" select="$version" />
|
||||
|
||||
<xsl:copy-of select="*" />
|
||||
</xsl:copy>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:document>
|
||||
<xsl:apply-templates select="$root" mode="preprocess" />
|
||||
</xsl:document>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Triggers preprocessing (this is the preprocessor entry point)
|
||||
|
||||
If multiple passes are needed, then they should be added here.
|
||||
-->
|
||||
<xsl:template match="*" mode="preprocess">
|
||||
<!-- currently, we only perform expansions (derivate additional content from
|
||||
the existing content) -->
|
||||
<xsl:variable name="result">
|
||||
<xsl:apply-templates select="." mode="preproc:expand" />
|
||||
</xsl:variable>
|
||||
|
||||
<!-- recurse if another pass has been scheduled -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$result//preproc:repass">
|
||||
<xsl:apply-templates select="$result" mode="preprocess" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<!-- no re-pass scheduled; return -->
|
||||
<xsl:copy-of select="$result" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- default expansion; do nothing -->
|
||||
<xsl:template match="*" mode="preproc:expand" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="preproc:repass" mode="preproc:expand" priority="5">
|
||||
<!-- remove to prevent infinite recursion -->
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Copies the given node and appends the given content
|
||||
|
||||
This performs no additional processing on the child nodes; the caller is
|
||||
responsible for determining what should be done next.
|
||||
-->
|
||||
<xsl:template match="*" mode="preproc:inject">
|
||||
<xsl:param name="content" />
|
||||
|
||||
<xsl:copy>
|
||||
<!-- copy all existing attributes and nodes in addition to the given
|
||||
content -->
|
||||
<xsl:copy-of select="@*|*|$content" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Injects content into either the given node or, if the given node does not
|
||||
exist, the provided new node
|
||||
|
||||
This simply abstracts "use if exists, otherwise use this", which is otherwise
|
||||
very verbose.
|
||||
-->
|
||||
<xsl:template name="preproc:injectornew">
|
||||
<xsl:param name="node" />
|
||||
<xsl:param name="new" />
|
||||
<xsl:param name="content" />
|
||||
|
||||
<!-- determine the node we will inject into (an existing one, if available,
|
||||
otherwise a new node -->
|
||||
<xsl:variable name="inject-into">
|
||||
<xsl:choose>
|
||||
<!-- if node exists, inject the content into it -->
|
||||
<xsl:when test="$node">
|
||||
<xsl:copy-of select="$node" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- otherwise, create the node anew and inject the content -->
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="$new" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- perform the injection! -->
|
||||
<xsl:apply-templates select="$inject-into" mode="preproc:inject">
|
||||
<xsl:with-param name="content">
|
||||
<xsl:copy-of select="$content" />
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Generate ids for groups that do not have one
|
||||
|
||||
We'll do our best to generate a sane id from the title.
|
||||
|
||||
Group ids are necessary for many operations, but the ids are primarily used
|
||||
internally; we shouldn't require that the developer provide one unless he/she
|
||||
actually needs to reference the group by its id.
|
||||
-->
|
||||
<xsl:template match="lv:group[ not( @id ) ]" mode="preproc:expand" priority="5">
|
||||
<xsl:variable name="title"
|
||||
select="if ( @title and not( @title = '' ) ) then
|
||||
@title
|
||||
else
|
||||
generate-id( . )" />
|
||||
|
||||
<xsl:copy>
|
||||
<!-- copy existing attributes -->
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- create an id from the title by removing spaces and other permitted
|
||||
chars (it is expected that @title is restricted such that we can do
|
||||
this without a problem) -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="translate( $title, ' ().-*:', '' )" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Generate ids for statics that do not have one
|
||||
-->
|
||||
<xsl:template mode="preproc:expand" priority="5"
|
||||
match="lv:static[ not( @id ) ]">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
<xsl:attribute name="id" select="generate-id( . )" />
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Determine group dimensions (either a scalar or a vector) based on
|
||||
the group style
|
||||
-->
|
||||
<xsl:template mode="preproc:expand" priority="4"
|
||||
match="lv:group[ not( @dim ) ]">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- TODO: store dimensions somewhere; this is a maintenance issue -->
|
||||
<xsl:attribute name="dim">
|
||||
<xsl:value-of
|
||||
select="if ( not( @style )
|
||||
or @style = 'flat'
|
||||
or @style = 'wide' ) then
|
||||
'0'
|
||||
else
|
||||
'1'" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Predicate require ids on the elemnts that they are operating on;
|
||||
generate option ids if a predicate is present.
|
||||
-->
|
||||
<xsl:template mode="preproc:expand" priority="5"
|
||||
match="lv:option[ @when and not( @id ) ]">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="concat( '__',
|
||||
parent::lv:question/@id,
|
||||
'_opt_',
|
||||
generate-id(.) )" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Inherit dimension from parent group
|
||||
|
||||
This will be populated on a repass once the group/@dim becomes
|
||||
available
|
||||
-->
|
||||
<xsl:template mode="preproc:expand" priority="5"
|
||||
match="lv:question[
|
||||
not( @dim )
|
||||
and exists( ancestor::lv:group/@dim ) ]">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<xsl:attribute name="dim">
|
||||
<xsl:value-of select="ancestor::lv:group/@dim" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Generate id for options containing predicates
|
||||
|
||||
Any option that contains a predicate must have an identifier that
|
||||
the UI framework can use to operate on it. The only situation in
|
||||
which this is currently applicable is when the option contains a
|
||||
predicate.
|
||||
-->
|
||||
<xsl:template mode="preproc:expand" priority="9"
|
||||
match="lv:question/lv:option[ @when
|
||||
and not( @id ) ]">
|
||||
<xsl:copy>
|
||||
<xsl:sequence select="@*" />
|
||||
|
||||
<xsl:attribute name="id"
|
||||
select="concat( parent::lv:question/@id,
|
||||
'__opt__',
|
||||
generate-id( . ) )" />
|
||||
|
||||
<xsl:sequence select="node()" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Copy @when from referenced question, unless overridden
|
||||
-->
|
||||
<xsl:template match="lv:answer[ not( @when ) and @ref=//lv:question[ @when ]/@id ]" mode="preproc:expand" priority="3">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- copy @when from referenced question -->
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:copy-of select="//lv:question[ @id=$ref ]/@when" />
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:answer[ not(@id) ]|lv:display[ not(@id) ]" mode="preproc:expand" priority="7">
|
||||
<xsl:copy>
|
||||
<!-- copy existing attributes -->
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- create an id from the ref by removing spaces and other permitted
|
||||
chars (making it easier to identify), followed by a unique id (to
|
||||
ensure that we do not have duplicate ids) -->
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="concat(translate( @ref, ' ().-', '' ), '_', generate-id(.))" />
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- recurse -->
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Expand assertion show/hide group triggers
|
||||
|
||||
This trigger will expand into two separate triggers: show and hide. They will
|
||||
be added as separate success/failure nodes, even if existing nodes are
|
||||
present; the reason for this is that merging can become complicated when the
|
||||
nodes contain their own attributes.
|
||||
|
||||
This will trigger another pass of the preprocessor (which is a much simpler
|
||||
implementation than the alternative) since content will have been added.
|
||||
-->
|
||||
<xsl:template match="
|
||||
assert:*/lv:trigger[
|
||||
@group='showhide'
|
||||
or @group='hideshow'
|
||||
]
|
||||
"
|
||||
mode="preproc:expand" priority="5">
|
||||
|
||||
<!-- How convenient that each event is four characters in length! The first
|
||||
four characters will be taken as the success event and the last four as
|
||||
the failure (note that XPath expressions are 1-indexed). -->
|
||||
<xsl:variable name="event-success"
|
||||
select="substring( @group, 1, 4 )" />
|
||||
<xsl:variable name="event-failure"
|
||||
select="substring( @group, 5 )" />
|
||||
|
||||
<!-- even though the XSD does not allow multiple success/failure nodes, this
|
||||
is the easiest implementation; the compiler will have no trouble with
|
||||
this -->
|
||||
<assert:success>
|
||||
<lv:trigger event="{$event-success}" ref="{@ref}" />
|
||||
</assert:success>
|
||||
<assert:failure>
|
||||
<lv:trigger event="{$event-failure}" ref="{@ref}" />
|
||||
</assert:failure>
|
||||
|
||||
<!-- we inserted content, so schedule another pass -->
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
CSR consists of three separate fields:
|
||||
- id
|
||||
- name
|
||||
- e-mail
|
||||
|
||||
This implementation is based on the custom Csr fields and class created by
|
||||
Shelly for snowmobile. It is designed to be functionally identical.
|
||||
|
||||
This overrides the default question generation template, which will then call
|
||||
the default template for new question nodes (instead of the csr one provided).
|
||||
This can be thought of like a macro.
|
||||
-->
|
||||
<xsl:template match="lv:question[@type='csr']" mode="preproc:expand" priority="5">
|
||||
<xsl:param name="id" select="@id" />
|
||||
|
||||
<lv:question type="select" id="agency_contact_id" required="true" class="csr">
|
||||
<xsl:attribute name="id" select="string-join( ($id, '_id'), '')" />
|
||||
<xsl:attribute name="label" select="string-join( (@label, 'Name'), ' ')" />
|
||||
</lv:question>
|
||||
|
||||
<lv:question type="text" id="agency_contact_name" required="true" hidden="true">
|
||||
<xsl:attribute name="id" select="string-join( ($id, '_name'), '')" />
|
||||
<xsl:attribute name="label" select="string-join( (@label, 'Name'), ' ')" />
|
||||
</lv:question>
|
||||
|
||||
<lv:question type="email" id="agency_contact_email" readonly="true" required="true">
|
||||
<xsl:attribute name="id" select="string-join( ($id, '_email'), '')" />
|
||||
<xsl:attribute name="label" select="string-join( (@label, 'E-mail'), ' ')" />
|
||||
</lv:question>
|
||||
|
||||
<lv:question type="phone" id="agency_contact_phone">
|
||||
<xsl:attribute name="id" select="string-join( ($id, '_phone'), '')" />
|
||||
<xsl:attribute name="label" select="string-join( (@label, 'Phone'), ' ')" />
|
||||
</lv:question>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
This set of templates will perform the following for each lv:question that
|
||||
uses the data API to set its label:
|
||||
- Generate a *_label ref to store the label
|
||||
- Add an lv:map to the lv:data element to populate the label
|
||||
- Rewrite the refs of any lv:answer that references the lv:question so that
|
||||
it points to the label ref
|
||||
|
||||
This solves the problem of lv:answers displaying unfriendly data if a step is
|
||||
loaded before the data API call is made on a previous step.
|
||||
-->
|
||||
<xsl:template match="lv:question[ lv:data/lv:label and not( @preproc:labeled ) ]"
|
||||
mode="preproc:expand" priority="5">
|
||||
|
||||
<!-- copy the question node, preprocessing the lv:data node -->
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*" />
|
||||
<xsl:attribute name="preproc:labeled" select="'true'" />
|
||||
|
||||
<xsl:apply-templates mode="preproc:expand" />
|
||||
</xsl:copy>
|
||||
|
||||
<!-- add our label ref to store the data (this will always be a text type) -->
|
||||
<lv:external id="{@id}_label" type="text" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:question/lv:data[ lv:label ]" mode="preproc:expand" priority="5">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*|*" />
|
||||
|
||||
<!-- add a map to our label ref to be populated with the rest of our data -->
|
||||
<lv:map param="{lv:label/@from}" into="{parent::lv:question/@id}_label" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:answer[ @ref=//lv:question[ lv:data/lv:label ]/@id ]" mode="preproc:expand" priority="5">
|
||||
<!-- convert into an lv:display, since we won't be referencing an lv:question anymore -->
|
||||
<lv:display>
|
||||
<!-- copy over any of the lv:answer attributes -->
|
||||
<xsl:copy-of select="@*" />
|
||||
|
||||
<!-- override ref to use our generated label ref -->
|
||||
<xsl:attribute name="ref" select="concat( @ref, '_label' )" />
|
||||
|
||||
<!-- explicitly add the type -->
|
||||
<xsl:attribute name="text" select="'text'" />
|
||||
|
||||
<!-- we'll need to add the label of the question as well to ensure proper display -->
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:attribute name="label" select="//lv:question[ @id=$ref ]/@label" />
|
||||
</lv:display>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- add lv:external nodes for every permitRef ref to ensure that they are
|
||||
initialized with proper defaults -->
|
||||
<xsl:template match="lv:group/lv:set[ @permitRef='true' ]"
|
||||
mode="preproc:expand"
|
||||
priority="2">
|
||||
<xsl:sequence select="." />
|
||||
|
||||
<xsl:for-each select="lv:*[ @ref ]">
|
||||
<lv:external type="{@type}" id="{@ref}">
|
||||
<xsl:if test="@dim">
|
||||
<xsl:attribute name="dim" select="@dim" />
|
||||
</xsl:if>
|
||||
</lv:external>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
If both @group and @event were provided, then the developer has done something
|
||||
wrong
|
||||
|
||||
Note that this has a higher priority than the other templates
|
||||
-->
|
||||
<xsl:template match="lv:trigger[ @group and @event ]" mode="preproc:expand" priority="9">
|
||||
<preproc:error>
|
||||
<xsl:text>Trigger cannot have both @group and @event</xsl:text>
|
||||
</preproc:error>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Catch invalid group triggers
|
||||
|
||||
Currently, we only support group triggers within assertions.
|
||||
-->
|
||||
<xsl:template match="lv:trigger[ @group ]" mode="preproc:expand" priority="4">
|
||||
<preproc:error>
|
||||
<xsl:text>Misplaced or unknown group trigger: </xsl:text>
|
||||
<xsl:value-of select="@group" />
|
||||
</preproc:error>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:group-set" mode="preproc:expand" priority="5">
|
||||
<xsl:variable name="self" select="." />
|
||||
|
||||
<!-- will be used as the prefix for each group id -->
|
||||
<xsl:variable name="id-prefix" select="@id" />
|
||||
|
||||
<xsl:for-each select="./lv:group-gen">
|
||||
<xsl:apply-templates select="following-sibling::lv:group-def" mode="preproc:gen-group">
|
||||
<xsl:with-param name="id-prefix" select="$id-prefix" />
|
||||
<xsl:with-param name="gen" select="." />
|
||||
</xsl:apply-templates>
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- this data will be useful, but we must ensure that it's ignored by the
|
||||
existing processor -->
|
||||
<preproc:sorted-groups id="{$id-prefix}">
|
||||
<xsl:for-each select="lv:group-gen">
|
||||
<preproc:group ref="{$id-prefix}_{@name}">
|
||||
<xsl:apply-templates select="//lv:group-sort" mode="preproc:gen-group">
|
||||
<xsl:with-param name="name" select="@name" />
|
||||
</xsl:apply-templates>
|
||||
</preproc:group>
|
||||
</xsl:for-each>
|
||||
</preproc:sorted-groups>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:group-sort" mode="preproc:gen-group" priority="5">
|
||||
<xsl:param name="name" />
|
||||
<xsl:variable name="by" select="@by" />
|
||||
<!-- TODO: template to generate name; this is duplicate logic -->
|
||||
|
||||
<preproc:sort by="{$name}_{$by}" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:group-def" mode="preproc:gen-group" priority="5">
|
||||
<xsl:param name="id-prefix" />
|
||||
<xsl:param name="gen" />
|
||||
|
||||
<xsl:variable name="name" select="$gen/@name" />
|
||||
|
||||
<lv:group id="{$id-prefix}_{$name}">
|
||||
<!-- all attributes on the group-def should be copied to the group itself -->
|
||||
<xsl:apply-templates select="@*|*" mode="preproc:gen-group">
|
||||
<xsl:with-param name="gen" select="$gen" />
|
||||
</xsl:apply-templates>
|
||||
</lv:group>
|
||||
|
||||
<preproc:repass />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:group-prop" mode="preproc:gen-group" priority="5">
|
||||
<xsl:param name="gen" />
|
||||
|
||||
<!-- retrieve the associated attribute from the group-gen node -->
|
||||
<xsl:variable name="ref" select="@ref" />
|
||||
<xsl:variable name="value" select="$gen/@*[ local-name() = $ref ]" />
|
||||
|
||||
<xsl:choose>
|
||||
<!-- if we didn't find a value, try a default -->
|
||||
<xsl:when test="not( $value )">
|
||||
<xsl:variable name="default" select="@default" />
|
||||
<xsl:value-of select="$gen/@*[ local-name() = $default ]" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- use the value we found -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$value" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="preproc:gen-group-attr" match="@*" mode="preproc:gen-group" priority="9">
|
||||
<xsl:param name="attr" select="." />
|
||||
<xsl:param name="gen" />
|
||||
|
||||
<xsl:attribute name="{local-name()}">
|
||||
<xsl:choose>
|
||||
<!-- has inline ref -->
|
||||
<xsl:when test="substring-before( $attr, '}' )">
|
||||
<!-- process any attribute data appearing before the first ref -->
|
||||
<xsl:call-template name="preproc:gen-group-attr">
|
||||
<xsl:with-param name="attr" select="substring-before( $attr, '{' )" />
|
||||
<xsl:with-param name="gen" select="$gen" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- process the curly-brace portion of the string -->
|
||||
<xsl:variable name="ref"
|
||||
select="substring-before( substring-after( $attr, '{' ), '}' )" />
|
||||
<xsl:value-of select="$gen/@*[ local-name() = $ref ]" />
|
||||
|
||||
<!-- process the remainder -->
|
||||
<xsl:call-template name="preproc:gen-group-attr">
|
||||
<xsl:with-param name="attr" select="substring-after( $attr, '}' )" />
|
||||
<xsl:with-param name="gen" select="$gen" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<!-- normal attribute -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$attr" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="preproc:gen-group" priority="1">
|
||||
<xsl:param name="gen" />
|
||||
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*" mode="preproc:gen-group">
|
||||
<xsl:with-param name="gen" select="$gen" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<!-- ensures CDATA is also processed -->
|
||||
<xsl:apply-templates mode="preproc:gen-group">
|
||||
<xsl:with-param name="gen" select="$gen" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,251 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Program UI compiler entry point
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:output
|
||||
method="xml"
|
||||
indent="yes"
|
||||
omit-xml-declaration="yes"
|
||||
/>
|
||||
|
||||
<!-- static development transformation -->
|
||||
<xsl:include href="static.xsl"/>
|
||||
|
||||
<!-- contains question type conversion -->
|
||||
<xsl:include href="question/question.xsl"/>
|
||||
|
||||
<!-- contains group styles -->
|
||||
<xsl:include href="group/group.xsl"/>
|
||||
|
||||
|
||||
<!--
|
||||
debug mode if XSLT 2.0 not supported
|
||||
|
||||
When in debug, the static stylesheet will be used. Note that in the future,
|
||||
browser detection should be used in addition to this check, so that the
|
||||
static development version is always displayed when viewing the XML file
|
||||
directly.
|
||||
-->
|
||||
<xsl:variable name="debug" select="number(system-property('xsl:version')) = 1.0"/>
|
||||
|
||||
|
||||
<!--
|
||||
Outputs navigation
|
||||
|
||||
Should be called from within a root program node
|
||||
-->
|
||||
<xsl:template name="navigation">
|
||||
<xsl:message>Generating step navigation menu...</xsl:message>
|
||||
|
||||
<ul class="step-nav">
|
||||
<xsl:for-each select="lv:step">
|
||||
<li class="{@type}">
|
||||
<a>
|
||||
<xsl:attribute name="href">#<xsl:value-of select="translate( @title, ' ', '_' )"/></xsl:attribute>
|
||||
<xsl:value-of select="@title"/>
|
||||
</a>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
generates separate template file for a given step
|
||||
-->
|
||||
<xsl:template match="/lv:program/lv:step">
|
||||
<xsl:variable name="name" select="lower-case(translate( @title, ' ', '_' ))"/>
|
||||
|
||||
<xsl:message>Generating step template for <xsl:value-of select="$name"/>...</xsl:message>
|
||||
|
||||
<xsl:apply-templates select="lv:group"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group/lv:static" mode="generate">
|
||||
<dt>
|
||||
<xsl:if test="@id">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="@id"/>
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- XXX: this is certainly not valid XHTML -->
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>[]</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>static widget</xsl:text>
|
||||
<!-- alternating rows (not sure when position() is returning by 2) -->
|
||||
<xsl:if test="position() mod 4 != 0"> alt</xsl:if>
|
||||
|
||||
<!-- add any user-defined classes -->
|
||||
<xsl:if test="@class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates mode="generate-static" />
|
||||
</dt>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:static" mode="generate-static">
|
||||
<xsl:apply-templates mode="generate-static" />
|
||||
</xsl:template>
|
||||
<xsl:template match="lv:prop" mode="generate-static">
|
||||
<xsl:apply-templates mode="generate-static" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:*" mode="generate-static" priority="5">
|
||||
<xsl:apply-templates select="." />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="xhtml:*" mode="generate-static" priority="3">
|
||||
<xsl:element name="{local-name(.)}">
|
||||
<xsl:apply-templates mode="generate-static"
|
||||
select="@*|node()" />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xhtml:*/@*" mode="generate-static" priority="3">
|
||||
<xsl:attribute name="{local-name(.)}">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="generate-static" priority="1">
|
||||
<xsl:message terminate="yes">
|
||||
<xsl:text>Invalid static element: </xsl:text>
|
||||
<xsl:copy-of select="." />
|
||||
</xsl:message>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="/lv:program/lv:step/lv:group/lv:answer|/lv:program/lv:step/lv:group/lv:display" mode="generate">
|
||||
<xsl:variable name="class">
|
||||
<xsl:text>answer</xsl:text>
|
||||
<!-- alternating rows (not sure when position() is returning by 2) -->
|
||||
<xsl:if test="position() mod 4 != 0"> alt</xsl:if>
|
||||
<xsl:if test="@class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
<xsl:if test="@internal = 'true'">
|
||||
<xsl:text> hidden i</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<dt>
|
||||
<xsl:if test="@id">
|
||||
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="class" select="$class" />
|
||||
|
||||
<!-- explicitly specified label should override the reference label -->
|
||||
<xsl:variable name="ref" select="@ref"/>
|
||||
<xsl:variable name="reflabel" select="//lv:question[@id=$ref]/@label" />
|
||||
<xsl:value-of select="if ( @label ) then @label else $reflabel" />
|
||||
</dt>
|
||||
<dd>
|
||||
<xsl:if test="@id">
|
||||
<xsl:attribute name="id"><xsl:value-of select="@id"/>_value</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="class" select="$class" />
|
||||
|
||||
<xsl:apply-templates select="." />
|
||||
</dd>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Answer and display are essentially the same thing. Answer simply gets most
|
||||
of its information from an existing question.
|
||||
-->
|
||||
<xsl:template match="lv:answer|lv:display">
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<!-- generate the ref (may contain a prefix) -->
|
||||
<xsl:variable name="ref">
|
||||
<xsl:if test="$prefix">
|
||||
<xsl:value-of select="$prefix" />
|
||||
<xsl:text>_</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- add on the id -->
|
||||
<xsl:value-of select="@ref" />
|
||||
</xsl:variable>
|
||||
|
||||
<!-- this names allows it to be transparently selected by the framework as any
|
||||
other element would -->
|
||||
<span data-index="0" name="{@id}[]" id="{@id}">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>answer </xsl:text>
|
||||
<xsl:value-of select="@type" />
|
||||
|
||||
<xsl:if test="@class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@internal = 'true'">
|
||||
<xsl:text> hidden i</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="data-answer-ref">
|
||||
<xsl:value-of select="$ref" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:if test="@id">
|
||||
<xsl:attribute name="data-field-name" select="@id" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@index">
|
||||
<xsl:attribute name="data-answer-static-index">
|
||||
<xsl:value-of select="@index" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@allow-html">
|
||||
<xsl:attribute name="data-field-allow-html"
|
||||
select="'true'" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="$ref" />
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Preproces source program XML
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lv="http://www.lovullo.com/rater"
|
||||
xmlns:lvp="http://www.lovullo.com"
|
||||
xmlns:assert="http://www.lovullo.com/assert"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<import href="expand.xsl" />
|
||||
|
||||
|
||||
<output method="xml"
|
||||
indent="yes" />
|
||||
|
||||
<!--
|
||||
A package will be generated representing a respective UI
|
||||
definition. The purpose of this package is to provide tight
|
||||
integration with the rest of the system, taking advantage of its
|
||||
functionality and built-in error checking.
|
||||
-->
|
||||
<template match="lvp:program"
|
||||
as="element( lvp:program )"
|
||||
priority="5">
|
||||
<copy>
|
||||
<sequence select="@*" />
|
||||
|
||||
<!-- intentional whitespace -->
|
||||
<comment>
|
||||
WARNING: Do NOT modify this file!
|
||||
It is auto-generated by progui-expand.
|
||||
</comment>
|
||||
|
||||
<!-- this variable exists purely for type/sanity checking -->
|
||||
<variable name="expanded" as="element( lvp:program )"
|
||||
select="lvp:expand( . )/lvp:program" />
|
||||
|
||||
<sequence select="$expanded/node()" />
|
||||
</copy>
|
||||
</template>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Builds the program
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
This stylesheet is responsible for generating all the templates, classes,
|
||||
etc for the given program. It will use transformations from other
|
||||
stylesheets, but will process them in a way suitable for a production
|
||||
environment.
|
||||
|
||||
AN XSLT 2.0 PARSER IS REQUIRED TO PROCESS THIS STYLESHEET!
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com"
|
||||
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
extension-element-prefixes="exsl">
|
||||
|
||||
<xsl:output
|
||||
method="xml"
|
||||
indent="yes"
|
||||
omit-xml-declaration="yes"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Main program stylesheet
|
||||
|
||||
This stylesheet does the actual transformations. It is also used to generate
|
||||
the default HTML displayed when visiting the XML file directly in the
|
||||
browser.
|
||||
-->
|
||||
<xsl:include href="program.xsl" />
|
||||
|
||||
<!-- output directory -->
|
||||
<xsl:param name="out-path" />
|
||||
|
||||
<!--
|
||||
Root template that kicks off the build process
|
||||
|
||||
This template has a high priority in order to ensure it overrides any default
|
||||
behavior present in any included templates.
|
||||
-->
|
||||
<xsl:template match="/lv:program" priority="10">
|
||||
<xsl:apply-templates select="." mode="build" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="/lv:program" mode="build">
|
||||
<!-- require XSLT 2.0 parser -->
|
||||
<xsl:if test="number(system-property('xsl:version')) < 2.0">
|
||||
<xsl:message terminate="yes">XSLT 2.0 processor required</xsl:message>
|
||||
</xsl:if>
|
||||
<xsl:message>Generating PHP templates...</xsl:message>
|
||||
<xsl:message></xsl:message>
|
||||
|
||||
<!-- generate each of the steps -->
|
||||
<xsl:apply-templates select="lv:step" mode="build" />
|
||||
|
||||
<!-- generate index page -->
|
||||
<xsl:result-document href="{$out-path}/index.phtml">
|
||||
<!-- step navigation -->
|
||||
<xsl:call-template name="navigation"/>
|
||||
|
||||
<form id="rater-step">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>
|
||||
JavaScript is required by this rater, but is currently disabled.
|
||||
Please enable it in your browser settings to continue.
|
||||
</strong>
|
||||
</p>
|
||||
</noscript>
|
||||
</form>
|
||||
</xsl:result-document>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Generates separate template file for a given step
|
||||
|
||||
This template will simply take the output of the transformation and place it
|
||||
in its own file. The result is a separate PHP template file for each step.
|
||||
-->
|
||||
<xsl:template match="/lv:program/lv:step" mode="build">
|
||||
<xsl:result-document href="{$out-path}/steps/{position()}.phtml">
|
||||
<!-- defer processing to other templates for this step -->
|
||||
<xsl:apply-templates select="." />
|
||||
</xsl:result-document>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Package map generation
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lv="http://www.lovullo.com/rater"
|
||||
xmlns:lvm="http://www.lovullo.com/rater/map"
|
||||
xmlns:lvp="http://www.lovullo.com"
|
||||
xmlns:assert="http://www.lovullo.com/assert"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<import href="expand.xsl" />
|
||||
|
||||
|
||||
<output method="xml"
|
||||
indent="yes" />
|
||||
|
||||
<template match="lvp:program" as="element( lvm:program-map )"
|
||||
priority="5">
|
||||
<lvm:program-map src="program">
|
||||
<!-- intentional whitespace -->
|
||||
<comment>
|
||||
WARNING: Do NOT modify this file!
|
||||
It is auto-generated by progui-pkg-map.
|
||||
</comment>
|
||||
|
||||
<variable name="qpreds" as="element( lvp:predicate )*"
|
||||
select="//lvp:predicate[ @type='q' ]" />
|
||||
|
||||
<apply-templates select="lvp:pred-uniq( $qpreds )" />
|
||||
</lvm:program-map>
|
||||
</template>
|
||||
|
||||
|
||||
<function name="lvp:pred-uniq" as="element( lvp:predicate )*">
|
||||
<param name="qpreds" as="element( lvp:predicate )*" />
|
||||
|
||||
<!-- copy to permit sibling comparison -->
|
||||
<variable name="copy" as="document-node()">
|
||||
<document>
|
||||
<for-each select="$qpreds">
|
||||
<copy-of select="." />
|
||||
</for-each>
|
||||
</document>
|
||||
</variable>
|
||||
|
||||
<sequence select="$copy/lvp:predicate[
|
||||
not( @ref =
|
||||
preceding-sibling::lvp:predicate/@ref ) ]" />
|
||||
</function>
|
||||
|
||||
|
||||
<template match="lvp:predicate">
|
||||
<lvm:map to="ui_q_{@ref}">
|
||||
<lvm:from name="{@ref}" default="1">
|
||||
<lvm:translate key="" value="0" />
|
||||
<lvm:translate key="0" value="0" />
|
||||
</lvm:from>
|
||||
</lvm:map>
|
||||
</template>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Program UI package for use with TAME
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lv="http://www.lovullo.com/rater"
|
||||
xmlns:lvp="http://www.lovullo.com"
|
||||
xmlns:assert="http://www.lovullo.com/assert"
|
||||
xmlns:c="http://www.lovullo.com/calc"
|
||||
xmlns:t="http://www.lovullo.com/rater/apply-template">
|
||||
|
||||
<import href="expand.xsl" />
|
||||
|
||||
|
||||
<output method="xml"
|
||||
indent="yes" />
|
||||
|
||||
<!--
|
||||
A package will be generated representing a respective UI
|
||||
definition. The purpose of this package is to provide tight
|
||||
integration with the rest of the system, taking advantage of its
|
||||
functionality and built-in error checking.
|
||||
-->
|
||||
<template match="lvp:program"
|
||||
as="element( lv:package )"
|
||||
priority="5">
|
||||
<lv:package title="Program UI"
|
||||
program="true">
|
||||
<!-- intentional whitespace -->
|
||||
<comment>
|
||||
WARNING: Do NOT modify this file!
|
||||
It is auto-generated by progui-pkg.
|
||||
</comment>
|
||||
|
||||
<!-- TODO: we should pass this in as a param -->
|
||||
<lv:import package="package-map" />
|
||||
|
||||
<sequence select="lvp:gen-params(
|
||||
//lvp:question[
|
||||
@id = //lvp:predicate[ @type = 'q' ]/@ref ] )" />
|
||||
<apply-templates />
|
||||
</lv:package>
|
||||
</template>
|
||||
|
||||
|
||||
<function name="lvp:gen-params">
|
||||
<param name="questions" as="element( lvp:question )*" />
|
||||
|
||||
<for-each select="$questions">
|
||||
<lv:param name="ui_q_{@id}"
|
||||
type="boolean"
|
||||
desc="Auto-generated by progui-pkg">
|
||||
<if test="not( @dim = '0' )">
|
||||
<attribute name="set" select="'vector'" />
|
||||
</if>
|
||||
</lv:param>
|
||||
</for-each>
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
UI import directives are translated essentially verbatim (namespace
|
||||
change only) into DSL imports; they must be used to import the
|
||||
packages necessary to satisfy any predicates.
|
||||
-->
|
||||
<template match="lvp:import"
|
||||
as="element( lv:import )"
|
||||
priority="5">
|
||||
<lv:import>
|
||||
<sequence select="@*|*" />
|
||||
</lv:import>
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
UI steps are translated into sections purely for organization and
|
||||
context retention through step titles.
|
||||
|
||||
Groups are handled in the same manner.
|
||||
-->
|
||||
<template match="lvp:step|lvp:group"
|
||||
as="element( lv:section )"
|
||||
priority="5">
|
||||
<variable name="title" as="xs:string"
|
||||
select="if ( not( @title ) or @title = '' ) then
|
||||
'(Untitled)'
|
||||
else
|
||||
@title" />
|
||||
|
||||
<lv:section title="{$title}">
|
||||
<apply-templates />
|
||||
|
||||
<!-- TODO: preprocessing should clean this shit up to normalize
|
||||
ids/refs for querying; we do this in a number of places -->
|
||||
<for-each select="lvp:question[
|
||||
@id = //lvp:predicate[ @type='q' ]/@ref
|
||||
or @ref = //lvp:predicate[ @type='q' ]/@ref ]">
|
||||
<variable name="id" as="xs:string"
|
||||
select="lvp:qid-to-class( @id )" />
|
||||
|
||||
<lv:classify as="--set-{$id}"
|
||||
desc="{local-name()} {@id} is set"
|
||||
keep="true">
|
||||
<t:match-gt on="ui_q_{@id}" const="0" />
|
||||
</lv:classify>
|
||||
</for-each>
|
||||
</lv:section>
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
Predicates are provided to a number of objects in the UI through a
|
||||
@code{@@when} attribute. These will be converted directly into
|
||||
classifications that will yield whether the predicate has matched
|
||||
for that object.
|
||||
-->
|
||||
<template match="lvp:question[ @when ]
|
||||
|lvp:display[ @when ]
|
||||
|lvp:static[ @when ]
|
||||
|lvp:option[ @when ]"
|
||||
priority="5">
|
||||
<variable name="self" as="element()"
|
||||
select="." />
|
||||
|
||||
<variable name="id" as="xs:string"
|
||||
select="if ( @id ) then @id else @ref" />
|
||||
<variable name="cid" as="xs:string"
|
||||
select="lvp:qid-to-class( $id )" />
|
||||
|
||||
<lv:classify as="--vis-{$cid}"
|
||||
desc="{local-name()} {@id} is visible"
|
||||
keep="true">
|
||||
<for-each select="lvp:predicate">
|
||||
<for-each select="lvp:expand-pred( $self, . )">
|
||||
<t:match-class name="{.}" />
|
||||
</for-each>
|
||||
</for-each>
|
||||
</lv:classify>
|
||||
|
||||
<apply-templates />
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
Assertions can reference classifications using the `c:*'
|
||||
syntax. The purpose of generating classifications here is to force
|
||||
the dependencies to be linked.
|
||||
-->
|
||||
<template match="assert:*[ starts-with( @ref, 'c:' ) ]"
|
||||
priority="5">
|
||||
<variable name="parent-id" as="xs:string"
|
||||
select="translate( ancestor::lvp:question/@id,
|
||||
'_', '-' )" />
|
||||
<variable name="class-name" as="xs:string"
|
||||
select="substring-after( @ref, 'c:' )" />
|
||||
|
||||
<variable name="unique" as="xs:string"
|
||||
select="generate-id(.)" />
|
||||
|
||||
|
||||
<lv:classify as="--vis-{$parent-id}-{$unique}"
|
||||
desc="{$parent-id} assertion predicate is applicable"
|
||||
keep="true">
|
||||
<t:match-class name="{$class-name}" />
|
||||
</lv:classify>
|
||||
|
||||
<apply-templates />
|
||||
</template>
|
||||
|
||||
|
||||
<function name="lvp:qid-to-class" as="xs:string">
|
||||
<param name="id" as="xs:string" />
|
||||
|
||||
<sequence select="translate(
|
||||
$id,
|
||||
'_ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'-abcdefghijklmnopqrstuvwxyz' )" />
|
||||
</function>
|
||||
|
||||
|
||||
<function name="lvp:expand-pred" as="xs:string*">
|
||||
<param name="src" as="element()" />
|
||||
<param name="pred" as="element( lvp:predicate )" />
|
||||
|
||||
<variable name="root" as="document-node( element( lvp:program ) )"
|
||||
select="root( $src )" />
|
||||
|
||||
<choose>
|
||||
<!-- standard predicate; use verbatim (note that, if there is no
|
||||
colon, both type and name will be empty) -->
|
||||
<when test="$pred/@type = 'c'">
|
||||
<sequence select="$pred/@name" />
|
||||
</when>
|
||||
|
||||
<!-- inherit predicates of referenced questions -->
|
||||
<when test="$pred/@type = 'q'">
|
||||
<variable name="qnode" as="element()?"
|
||||
select="$root//lvp:question[ @id=$pred/@ref ],
|
||||
$root//lvp:calc[ @id=$pred/@ref ]" />
|
||||
|
||||
<if test="not( $qnode )">
|
||||
<message terminate="yes"
|
||||
select="concat(
|
||||
'error: unknown qwhen reference ',
|
||||
$pred/@ref, ' by ',
|
||||
$src/@id )" />
|
||||
</if>
|
||||
|
||||
<variable name="qpreds" as="element( lvp:predicate )*"
|
||||
select="$qnode/lvp:predicate" />
|
||||
|
||||
<for-each select="$qpreds">
|
||||
<sequence select="lvp:expand-pred( $qnode, . )" />
|
||||
</for-each>
|
||||
|
||||
<!-- and assert against the value of the reference -->
|
||||
<sequence select="concat( '--set-',
|
||||
lvp:qid-to-class( $pred/@ref ) )" />
|
||||
</when>
|
||||
|
||||
<!-- unknown -->
|
||||
<otherwise>
|
||||
<message terminate="yes"
|
||||
select="concat(
|
||||
'error: unknown predicate type `',
|
||||
$pred/@type, '` used by ',
|
||||
$src/@id )" />
|
||||
</otherwise>
|
||||
</choose>
|
||||
</function>
|
||||
|
||||
|
||||
<!--
|
||||
Copy all nodes in the DSL's namespace verbatim
|
||||
-->
|
||||
<template match="lv:*" priority="5">
|
||||
<copy-of select="." />
|
||||
</template>
|
||||
|
||||
|
||||
<!--
|
||||
All unrecognized semantic elements are ignored.
|
||||
-->
|
||||
<template match="node()"
|
||||
priority="1">
|
||||
<apply-templates />
|
||||
</template>
|
||||
|
||||
</stylesheet>
|
||||
|
|
@ -0,0 +1,518 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Generic template used for all text fields
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The type of the field is added as a class so that styling or other
|
||||
JavaScript transformations may take place.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<!-- available question types -->
|
||||
<xsl:include href="types/all.xsl" />
|
||||
|
||||
<xsl:template name="generic-text">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="type" select="@type" />
|
||||
<xsl:param name="hidden" select="@hidden" />
|
||||
<xsl:param name="maxlength" />
|
||||
|
||||
<input type="text">
|
||||
<xsl:if test="$maxlength">
|
||||
<xsl:attribute name="maxlength" select="$maxlength" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="type" select="$type" />
|
||||
<xsl:with-param name="hidden" select="$hidden" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</input>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="generic-textarea">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="type" select="@type" />
|
||||
<xsl:param name="hidden" select="@hidden" />
|
||||
<xsl:param name="maxlength" select="'1000'" />
|
||||
<textarea>
|
||||
<xsl:attribute name="maxlength"
|
||||
select="$maxlength" />
|
||||
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="type" select="$type" />
|
||||
<xsl:with-param name="hidden" select="$hidden" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</textarea>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generic attributes to be used for most questions
|
||||
-->
|
||||
<xsl:template name="generic-attributes">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="type" select="@type" />
|
||||
<xsl:param name="index" select="''" />
|
||||
<xsl:param name="ignore-required" select="0" />
|
||||
<xsl:param name="hidden" select="@hidden" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="ref-id" select="@id" />
|
||||
|
||||
<!-- generate the ref (may contain a prefix) -->
|
||||
<xsl:variable name="genid">
|
||||
<xsl:if test="$prefix">
|
||||
<xsl:value-of select="$prefix" />
|
||||
<xsl:text>_</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- add on the id -->
|
||||
<xsl:value-of select="$id" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="id" select="$genid" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:if test="@readonly = true()">
|
||||
<xsl:attribute name="readonly">
|
||||
<xsl:text>readonly</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>widget input </xsl:text>
|
||||
<xsl:value-of select="$type"/>
|
||||
<xsl:if test="@required">
|
||||
<xsl:if test="not($ignore-required)">
|
||||
<xsl:text> required</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="@readonly = true()">
|
||||
<xsl:text> readonly</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$hidden = true()">
|
||||
<xsl:text> hidden</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@internal = true()">
|
||||
<xsl:text> internal</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="name">
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:if test="@default">
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="@default" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- include the id as an HTML5 data-* attribute (so we don't need to worry
|
||||
about stripping [] off of the end of @name) -->
|
||||
<xsl:attribute name="data-field-name" select="$ref-id" />
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generates question id for the current node
|
||||
-->
|
||||
<xsl:template name="qid">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="quote" select="false()" />
|
||||
<xsl:param name="index" select="0" />
|
||||
<xsl:param name="index-var" select="false()" />
|
||||
<xsl:param name="suffix" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="prefix_" select="false()" />
|
||||
|
||||
<!-- opening quote -->
|
||||
<xsl:if test="$quote"><xsl:text>'</xsl:text></xsl:if>
|
||||
|
||||
<!-- apply prefix -->
|
||||
<xsl:if test="string( $prefix ) != ''">
|
||||
<xsl:value-of select="$prefix" />
|
||||
</xsl:if>
|
||||
<xsl:if test="$prefix_ = true()">
|
||||
<xsl:text>_</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- generate qid -->
|
||||
<xsl:text>q_</xsl:text><xsl:value-of select="$id" />
|
||||
|
||||
<!-- apply suffix -->
|
||||
<xsl:if test="string( $suffix ) != ''">
|
||||
<xsl:value-of select="$suffix" />
|
||||
</xsl:if>
|
||||
|
||||
<!-- append an index suffix, if provided -->
|
||||
<xsl:if test="string($index) != '' and not($index-var)">
|
||||
<xsl:text>_</xsl:text><xsl:value-of select="$index" />
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$index-var and not($quote)">
|
||||
<xsl:message terminate="yes">qid index vars may only be used with quoted qids</xsl:message>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$quote">
|
||||
<!-- variable index suffix -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$index-var">
|
||||
<xsl:text>_' + </xsl:text>
|
||||
<xsl:value-of select="$index" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- closing quote -->
|
||||
<xsl:otherwise>
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Shorthand for generating variable qids
|
||||
-->
|
||||
<xsl:template name="qid-var">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="index" select="'i'" />
|
||||
<xsl:param name="suffix" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="quote" select="true()" />
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
<xsl:with-param name="index-var" select="true()" />
|
||||
<xsl:with-param name="suffix" select="$suffix" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Shorthand for generating a qid-var for use in a query
|
||||
|
||||
e.g. #id_0
|
||||
-->
|
||||
<xsl:template name="qid-var-query">
|
||||
<xsl:param name="id" select="@id" />
|
||||
|
||||
<xsl:call-template name="qid-var">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="'#'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generates a question name with the index
|
||||
-->
|
||||
<xsl:template name="qname">
|
||||
<xsl:param name="index" select="''" />
|
||||
<xsl:param name="quote" select="false()" />
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="index-var" select="false()" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<!-- opening quote -->
|
||||
<xsl:if test="$quote"><xsl:text>'</xsl:text></xsl:if>
|
||||
|
||||
<!-- generate name -->
|
||||
<xsl:if test="$prefix">
|
||||
<xsl:value-of select="$prefix" />
|
||||
<xsl:text>_</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- add on the id -->
|
||||
<xsl:value-of select="$id" />
|
||||
|
||||
<xsl:call-template name="qi">
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
<xsl:with-param name="index-var" select="$index-var" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- closing quote -->
|
||||
<xsl:if test="$quote"><xsl:text>'</xsl:text></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Shorthand for creating variable qnames
|
||||
-->
|
||||
<xsl:template name="qname-var">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="index" select="'i'" />
|
||||
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="quote" select="true()" />
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
<xsl:with-param name="index-var" select="true()" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generates question index
|
||||
|
||||
The logic for this is non-existant at present (since multiple indicies are
|
||||
generally generated at runtime), however we supply the separate template in
|
||||
order to easily modify that logic in the future.
|
||||
-->
|
||||
<xsl:template name="qi">
|
||||
<xsl:param name="index" select="''" />
|
||||
<xsl:param name="index-var" select="false()" />
|
||||
|
||||
<xsl:text>[</xsl:text>
|
||||
|
||||
<xsl:if test="$index-var">' + </xsl:if>
|
||||
<xsl:value-of select="$index" />
|
||||
<xsl:if test="$index-var"> + '</xsl:if>
|
||||
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Same concept as the "qi" template, but doesn't represent as an array index.
|
||||
|
||||
Ex: "_0"
|
||||
-->
|
||||
<xsl:template name="qi-suffix">
|
||||
<xsl:param name="index" select="0" />
|
||||
<xsl:text>_</xsl:text><xsl:value-of select="$index" />
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generates a question id with the index
|
||||
-->
|
||||
<xsl:template name="qidi">
|
||||
<xsl:param name="index" select="0" />
|
||||
|
||||
<xsl:call-template name="qid" />
|
||||
<xsl:call-template name="qi-suffix">
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Generates a query string for a qidi template for use with functions like
|
||||
dojo.query or jquery
|
||||
|
||||
Returns something like: '#qid_' + i
|
||||
-->
|
||||
<xsl:template name="qidi-query-var">
|
||||
<xsl:text>'#</xsl:text>
|
||||
<xsl:call-template name="qidi">
|
||||
<xsl:with-param name="index">' + i</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- deprecated; forwards to qname -->
|
||||
<xsl:template name="qnamei">
|
||||
<xsl:param name="index" select="0" />
|
||||
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="index" select="$index" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="qcopy-id">
|
||||
<!-- if an id was provided, use that -->
|
||||
<xsl:if test="@id">
|
||||
<xsl:value-of select="@id" />
|
||||
</xsl:if>
|
||||
<!-- otherwise generate our own -->
|
||||
<xsl:if test="not(@id)">
|
||||
<xsl:value-of select="@ref" />_<xsl:value-of select="generate-id(.)" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- copy the referenced question in place -->
|
||||
<xsl:template match="lv:question-copy" mode="generate">
|
||||
<xsl:variable name="ref" select="@ref"/>
|
||||
|
||||
<xsl:apply-templates select="//lv:question[@id=$ref]" mode="generate">
|
||||
<xsl:with-param name="id">
|
||||
<xsl:call-template name="qcopy-id" />
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="ref-id" select="$ref" />
|
||||
<xsl:with-param name="value" select="@value" />
|
||||
<xsl:with-param name="elementLabel" select="@elementLabel" />
|
||||
|
||||
<!-- overrides (optional) -->
|
||||
<xsl:with-param name="class-override" select="@class" />
|
||||
<xsl:with-param name="hidden-override" select="@hidden" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<!-- question-copy for when mode != "generate" -->
|
||||
<xsl:template match="lv:question-copy">
|
||||
<xsl:variable name="ref" select="@ref"/>
|
||||
<xsl:apply-templates select="//lv:question[@id=$ref]">
|
||||
<xsl:with-param name="id">
|
||||
<xsl:call-template name="qcopy-id" />
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="value" select="@value" />
|
||||
<xsl:with-param name="elementLabel" select="@elementLabel" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<!-- default template if question type was not found -->
|
||||
<xsl:template match="lv:question">
|
||||
<xsl:variable name="error">
|
||||
Unknown element type '<xsl:value-of select="@type"/>'
|
||||
for question '<xsl:value-of select="@id"/>'
|
||||
</xsl:variable>
|
||||
|
||||
<!-- log the error -->
|
||||
<xsl:message>
|
||||
<xsl:value-of select="$error"/>
|
||||
</xsl:message>
|
||||
|
||||
<!-- display the error in the generated HTML to grab attention -->
|
||||
<em class="error" style="color:red">
|
||||
<strong>Error:</strong> <xsl:value-of select="$error"/>
|
||||
</em>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lv:question" mode="generate">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="class-override" />
|
||||
<xsl:param name="hidden-override" />
|
||||
|
||||
<xsl:variable name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$class-override">
|
||||
<xsl:value-of select="$class-override" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@class" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="hidden">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$hidden-override">
|
||||
<xsl:value-of select="$hidden-override" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@hidden" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<dt id="qlabel_{@id}">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="@type" />
|
||||
<xsl:if test="$hidden = 'true'">
|
||||
<xsl:text> hidden</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$class" />
|
||||
</xsl:if>
|
||||
<xsl:if test="@internal = true()">
|
||||
<xsl:text> hidden i</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- if in debug, add an anchor to easily locate questions -->
|
||||
<xsl:if test="$debug">
|
||||
<xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
|
||||
<a name="_{@id}"/>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="@label"/>
|
||||
</dt>
|
||||
<dd id="qcontainer_{@id}">
|
||||
<xsl:attribute name="data-contained-field-name" select="@id" />
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="@type" />
|
||||
<xsl:if test="$hidden = 'true'">
|
||||
<xsl:text> hidden</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$class">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$class" />
|
||||
</xsl:if>
|
||||
<xsl:if test="@internal = true()">
|
||||
<xsl:text> hidden i</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- add question id as tooltip for debugging purposes -->
|
||||
<xsl:if test="$debug">
|
||||
<xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- allow the templates for the specific question types to be applied -->
|
||||
<xsl:apply-templates select=".">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<!-- generate actions -->
|
||||
<xsl:apply-templates select="./lv:action" mode="generate">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
</xsl:apply-templates>
|
||||
</dd>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="lv:question/lv:action[ @style='button' ]" mode="generate">
|
||||
<!-- question id (may vary from the parent id) -->
|
||||
<xsl:param name="id" />
|
||||
|
||||
<button class="action" data-type="{@on}" data-ref="{$id}">
|
||||
<xsl:value-of select="@desc" />
|
||||
</button>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
Default 'default' value, if no implementation is given for the specific
|
||||
question type
|
||||
-->
|
||||
<xsl:template match="lv:*" mode="get-default">
|
||||
<xsl:if test="@default">
|
||||
<xsl:value-of select="@default" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Address question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='address']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
All avalable question types
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<!-- simply includes all the question types -->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:include href="address.xsl"/>
|
||||
<xsl:include href="city.xsl"/>
|
||||
<xsl:include href="currency.xsl"/>
|
||||
<xsl:include href="date.xsl"/>
|
||||
<xsl:include href="dba.xsl"/>
|
||||
<xsl:include href="dollars.xsl"/>
|
||||
<xsl:include href="email.xsl"/>
|
||||
<xsl:include href="explain.xsl"/>
|
||||
<xsl:include href="float.xsl"/>
|
||||
<xsl:include href="initial.xsl"/>
|
||||
<xsl:include href="manualDate.xsl"/>
|
||||
<xsl:include href="shortDate.xsl"/>
|
||||
<xsl:include href="ccExpDate.xsl"/>
|
||||
<xsl:include href="ccNumber.xsl"/>
|
||||
<xsl:include href="name.xsl"/>
|
||||
<xsl:include href="noyes.xsl"/>
|
||||
<xsl:include href="number.xsl"/>
|
||||
<xsl:include href="percent.xsl"/>
|
||||
<xsl:include href="personalId.xsl"/>
|
||||
<xsl:include href="phone.xsl"/>
|
||||
<xsl:include href="radio.xsl"/>
|
||||
<xsl:include href="legacyradio.xsl"/>
|
||||
<xsl:include href="select.xsl"/>
|
||||
<xsl:include href="state.xsl"/>
|
||||
<xsl:include href="submit.xsl"/>
|
||||
<xsl:include href="textarea.xsl"/>
|
||||
<xsl:include href="text.xsl"/>
|
||||
<xsl:include href="url.xsl"/>
|
||||
<xsl:include href="year.xsl"/>
|
||||
<xsl:include href="zip.xsl"/>
|
||||
<xsl:include href="cvv2.xsl"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
CC expiration date question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
This type collects very sensitive PII that may be subject to PCI
|
||||
regulations. Be warned.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='ccExpDate']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
CC number question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
This type collects very sensitive PII that may be subject to PCI
|
||||
regulations. Be warned.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='ccNumber']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
City question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='city']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Currency question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='currency']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
CVV2 question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
This type collects very sensitive PII that may be subject to PCI
|
||||
regulations; CVV2 numbers must be processed immediately and must not be
|
||||
stored, even if encrypted. Be warned.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='cvv2']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<input type="text">
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
</xsl:call-template>
|
||||
</input>
|
||||
<a class="action" data-ref="{$id}_cvv2_dialog_content" data-type="cvv2Dialog" >What is CVV/CSV?</a>
|
||||
<div class="cvv2-dialog-box-wrapper" id="{$id}_cvv2_dialog_content" >
|
||||
<div class="cvv2-row-clear" >
|
||||
<img class="cvv2-image-left" src="/images/cvv_card_back.png" />
|
||||
<b>Visa®, Mastercard®, and Discover® cardholders:</b>
|
||||
<p>Turn your card over and look at the signature box. You should see either the entire 16-digit credit card
|
||||
number or just the last four digits followed by a special 3-digit code. This 3-digit code is your CVV
|
||||
number / Card Security Code.</p>
|
||||
</div>
|
||||
<div class="cvv2-row-clear" >
|
||||
<img class="cvv2-image-right" src="/images/cvv_card_front.png" />
|
||||
<b>American Express® cardholders:</b>
|
||||
<p>Look for the 4-digit code printed on the front of your card just above and to the right of your main
|
||||
credit card number. This 4-digit code is your Card Identification Number (CID). The CID is the four-digit
|
||||
code printed just above the Account Number.</p>
|
||||
</div>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
determines the default value
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='cvv2']" mode="get-default">
|
||||
<xsl:value-of select="if ( @default ) then @default else ''" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Date question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='date']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
DBA ("doing business as") question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='dba']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Whole-dollar amount question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='dollars']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
E-mail address question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='email']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Explanation question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='explain']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Floating point question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Consider using a more specific type (e.g. currency).
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='float']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Name initials question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='initial']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
<xsl:with-param name="maxlength" select="'1'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Radio question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='legacyradio']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="value" select="@value" />
|
||||
<xsl:param name="elementLabel" select="@elementLabel" />
|
||||
|
||||
<label>
|
||||
<input type="radio">
|
||||
<xsl:attribute name="data-legacy">legacy</xsl:attribute>
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- use value if available, otherwise the HTML default of 'on' -->
|
||||
<xsl:attribute name="value" select="if ( $value ) then $value else 'on'" />
|
||||
</input>
|
||||
|
||||
<!-- output label if requested -->
|
||||
<xsl:if test="$elementLabel">
|
||||
<label>
|
||||
<xsl:attribute name="for" select="$id" />
|
||||
<xsl:value-of select="$elementLabel" />
|
||||
</label>
|
||||
</xsl:if>
|
||||
</label>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Date question type without helper dialogs
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='manualDate']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Name question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='name']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
|
||||
<!-- we can determine a better limit; this limit is the limit in ARIC's
|
||||
system -->
|
||||
<xsl:with-param name="maxlength" select="'35'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
No/yes question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Go ahead; ask why we don't have yes/no.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='noyes']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<div style="white-space: nowrap">
|
||||
<label>
|
||||
<input type="checkbox" value="0">
|
||||
<xsl:attribute name="data-field-name" select="$id" />
|
||||
<xsl:attribute name="style">padding: 0;</xsl:attribute>
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="suffix" select="'_n'" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>widget</xsl:text>
|
||||
|
||||
<xsl:if test="@required = true()">
|
||||
<xsl:text> required</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="name">
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="@default = 'no'">
|
||||
<xsl:attribute name="checked">checked</xsl:attribute>
|
||||
</xsl:if>
|
||||
</input> No
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" value="1">
|
||||
<xsl:attribute name="data-field-name" select="$id" />
|
||||
<xsl:attribute name="style">padding: 0;</xsl:attribute>
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="suffix" select="'_y'" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>widget</xsl:text>
|
||||
|
||||
<xsl:if test="@required = true()">
|
||||
<xsl:text> required</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="name">
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="@default = 'yes'">
|
||||
<xsl:attribute name="checked">checked</xsl:attribute>
|
||||
</xsl:if>
|
||||
</input> Yes
|
||||
</label>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
determines the default value
|
||||
|
||||
If 'yes', then default is 1
|
||||
If 'no', then default is 0
|
||||
Else, default is empty
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='noyes']" mode="get-default">
|
||||
<xsl:if test="@default='yes'">
|
||||
<xsl:text>1</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="@default='no'">
|
||||
<xsl:text>0</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Number question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='number']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<input type="text">
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
</xsl:call-template>
|
||||
<xsl:if test="not(@default)">
|
||||
<xsl:attribute name="value">0</xsl:attribute>
|
||||
</xsl:if>
|
||||
</input>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
determines the default value
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='number']" mode="get-default">
|
||||
<xsl:value-of select="if ( @default ) then @default else '0'" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Percent dropdown question type, incremeting by 5
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='percent']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<select>
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="question-percent-option" />
|
||||
</select>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
recursively generates percent options
|
||||
(equivalent to for ( $i = 0; $i <= 100; $i += 5 ))
|
||||
-->
|
||||
<xsl:template name="question-percent-option">
|
||||
<xsl:param name="i">0</xsl:param>
|
||||
|
||||
<xsl:if test="$i < 101">
|
||||
<option>
|
||||
<xsl:attribute name="value"><xsl:value-of select="$i" /></xsl:attribute>
|
||||
<xsl:value-of select="$i" />%
|
||||
</option>
|
||||
|
||||
<xsl:call-template name="question-percent-option">
|
||||
<xsl:with-param name="i">
|
||||
<xsl:value-of select="$i + 5" />
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Personal identifier question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='personalId']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Phone number question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='phone']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Radio button question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='radio']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
<xsl:param name="value" select="@value" />
|
||||
<xsl:param name="elementLabel" select="@elementLabel" />
|
||||
|
||||
<ul>
|
||||
<xsl:variable name="question_length" select="count(lv:option)" />
|
||||
|
||||
<xsl:for-each select="lv:option">
|
||||
<li style="display: inline">
|
||||
<input type="checkbox" value="0">
|
||||
<xsl:attribute name="data-field-name" select="$id" />
|
||||
<xsl:attribute name="style">padding: 0;</xsl:attribute>
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="suffix" select="concat('_',position())" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="name">
|
||||
<xsl:call-template name="qname">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>widget radiobox</xsl:text>
|
||||
|
||||
<xsl:if test="@required = true()">
|
||||
<xsl:text> required</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
|
||||
|
||||
<!-- value attribute (required) -->
|
||||
<xsl:attribute name="value" select="@value" />
|
||||
|
||||
<xsl:attribute name="data-question-length" select="$question_length" />
|
||||
|
||||
<xsl:if test="@default">
|
||||
<xsl:attribute name="checked">checked</xsl:attribute>
|
||||
</xsl:if>
|
||||
</input>
|
||||
|
||||
<xsl:if test=". = '-'">
|
||||
<xsl:value-of select="@value"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="not( . = '-' )">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
determines the default value
|
||||
|
||||
If 'yes', then default is 1
|
||||
If 'no', then default is 0
|
||||
Else, default is empty
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='radio']" mode="get-default">
|
||||
<xsl:variable name="default" select="lv:option[@default='true']" />
|
||||
<xsl:if test="$default">
|
||||
<xsl:value-of select="if ( $default/@value ) then $default/@value else ''" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Select (dropdown) question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='select']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<select>
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:for-each select="lv:option">
|
||||
<option>
|
||||
<!-- optional id -->
|
||||
<xsl:if test="@id">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:call-template name="qid">
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- value attribute (required) -->
|
||||
<xsl:attribute name="value" select="@value" />
|
||||
|
||||
<!-- optional default attribute -->
|
||||
<xsl:if test="@default">
|
||||
<xsl:attribute name="selected">selected</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- the value of the node -->
|
||||
<xsl:if test=". = '-'">
|
||||
<xsl:value-of select="@value"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="not( . = '-' )">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:if>
|
||||
</option>
|
||||
</xsl:for-each>
|
||||
</select>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
determines the default value
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='select']" mode="get-default">
|
||||
<xsl:variable name="default" select="lv:option[@default='true']" />
|
||||
|
||||
<!-- first attempt to use the value marked as the default -->
|
||||
<xsl:choose>
|
||||
<!-- a default node was found -->
|
||||
<xsl:when test="$default">
|
||||
<xsl:value-of select="if ( $default/@value ) then $default/@value else ''" />
|
||||
</xsl:when>
|
||||
|
||||
<!-- otherwise, use the first element as the default, since this is what will
|
||||
be displayed by default in the client -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="lv:option[1]/@value" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Date-sans-day question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='shortDate']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
US State dropdown question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='state']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<select>
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
|
||||
<option value="0" class="default">(Please select)</option>
|
||||
<option value="AL">Alabama</option>
|
||||
<option value="AK">Alaska</option>
|
||||
<option value="AZ">Arizona</option>
|
||||
<option value="AR">Arkansas</option>
|
||||
<option value="CA">California</option>
|
||||
<option value="CO">Colorado</option>
|
||||
<option value="CT">Connecticut</option>
|
||||
<option value="DE">Delaware</option>
|
||||
<option value="FL">Florida</option>
|
||||
<option value="GA">Georgia</option>
|
||||
<option value="HI">Hawaii</option>
|
||||
<option value="ID">Idaho</option>
|
||||
<option value="IL">Illinois</option>
|
||||
<option value="IN">Indiana</option>
|
||||
<option value="IA">Iowa</option>
|
||||
<option value="KS">Kansas</option>
|
||||
<option value="KY">Kentucky</option>
|
||||
<option value="LA">Louisiana</option>
|
||||
<option value="ME">Maine</option>
|
||||
<option value="MD">Maryland</option>
|
||||
<option value="MA">Massachusetts</option>
|
||||
<option value="MI">Michigan</option>
|
||||
<option value="MN">Minnesota</option>
|
||||
<option value="MS">Mississippi</option>
|
||||
<option value="MO">Missouri</option>
|
||||
<option value="MT">Montana</option>
|
||||
<option value="NE">Nebraska</option>
|
||||
<option value="NV">Nevada</option>
|
||||
<option value="NH">New Hampshire</option>
|
||||
<option value="NJ">New Jersey</option>
|
||||
<option value="NM">New Mexico</option>
|
||||
<option value="NY">New York</option>
|
||||
<option value="NC">North Carolina</option>
|
||||
<option value="ND">North Dakota</option>
|
||||
<option value="OH">Ohio</option>
|
||||
<option value="OK">Oklahoma</option>
|
||||
<option value="OR">Oregon</option>
|
||||
<option value="PA">Pennsylvania</option>
|
||||
<option value="RI">Rhode Island</option>
|
||||
<option value="SC">South Carolina</option>
|
||||
<option value="SD">South Dakota</option>
|
||||
<option value="TN">Tennessee</option>
|
||||
<option value="TX">Texas</option>
|
||||
<option value="UT">Utah</option>
|
||||
<option value="VT">Vermont</option>
|
||||
<option value="VA">Virginia</option>
|
||||
<option value="WA">Washington</option>
|
||||
<option value="WV">West Virginia</option>
|
||||
<option value="WI">Wisconsin</option>
|
||||
<option value="WY">Wyoming</option>
|
||||
</select>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
default value
|
||||
-->
|
||||
<xsl:template match="lv:*[@type='state']" mode="get-default">
|
||||
<xsl:if test="@default">
|
||||
<xsl:value-of select="@default" />
|
||||
</xsl:if>
|
||||
<xsl:if test="not(@default)">
|
||||
<xsl:text>0</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Submit button question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='submit']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<input type="submit">
|
||||
<xsl:call-template name="generic-attributes">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="@label" />
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Generic text question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='text']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Textarea question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='textarea']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-textarea">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
URL question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='url']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Numeric year question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='year']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Zip code (US/Canada) question type
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="lv:question[@type='zip']">
|
||||
<xsl:param name="id" select="@id" />
|
||||
<xsl:param name="prefix" />
|
||||
|
||||
<xsl:call-template name="generic-text">
|
||||
<xsl:with-param name="id" select="$id" />
|
||||
<xsl:with-param name="prefix" select="$prefix" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
Single-page template used when XSL version doesn't support result-document,
|
||||
which is added in version 2.0
|
||||
|
||||
Copyright (C) 2017 LoVullo Associates, Inc.
|
||||
|
||||
This file is part of the Liza Program UI Compiler.
|
||||
|
||||
liza-proguic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
TODO: use system-property('xsl:vendor') to show one page in browsers, unless the
|
||||
browser will properly recognize multiple pages
|
||||
|
||||
better TODO: this is no longer used, so get rid of it
|
||||
-->
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:lv="http://www.lovullo.com">
|
||||
|
||||
<xsl:template match="/lv:program"
|
||||
use-when="number(system-property('xsl:version')) = 1.0"
|
||||
priority="2">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Program Design: <xsl:value-of select="@title"/></title>
|
||||
<script src="../../../src/www/scripts/dojo/dojo.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
dojo.require( '/djConfig' );
|
||||
djConfig.baseUrl = '../../../src/www/scripts/';
|
||||
dojo.require( 'dijit.form.CurrencyTextBox' );
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1><xsl:value-of select="@title"/></h1>
|
||||
<xsl:if test="@description">
|
||||
<p class="program-desc">
|
||||
<xsl:value-of select="@description"/>
|
||||
</p>
|
||||
</xsl:if>
|
||||
|
||||
<!-- step navigation -->
|
||||
<xsl:call-template name="navigation"/>
|
||||
|
||||
<blockquote id="devnote">
|
||||
You are currently viewing the XSL 1.0 HTML representation of the
|
||||
<xsl:value-of select="@title"/> XML document, which is generated to aid
|
||||
in development. This is <em>not</em> what the production HTML will look
|
||||
like. To see that, please apply the XSL transformation using an XSL 2.0
|
||||
compatiable parser. This will be automatically done during the build
|
||||
processes.
|
||||
</blockquote>
|
||||
|
||||
<xsl:apply-templates select="lv:step" mode="static"/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--
|
||||
static step
|
||||
|
||||
Outputs step in a separate div with an anchor and a title. This is intended to
|
||||
be output in a single page with the rest of the steps.
|
||||
-->
|
||||
<xsl:template match="lv:step" mode="static">
|
||||
<xsl:variable name="anchor" select="translate( @title, ' ', '_' )"/>
|
||||
|
||||
<xsl:message>Generating static step for <xsl:value-of select="$anchor"/>...</xsl:message>
|
||||
|
||||
<div>
|
||||
<xsl:attribute name="id">step_<xsl:value-of select="$anchor"/></xsl:attribute>
|
||||
<xsl:attribute name="class">step-content</xsl:attribute>
|
||||
|
||||
<!-- anchor / heading (may want to hide with navigation properly displayed
|
||||
and when we have jQuery magic -->
|
||||
<a>
|
||||
<xsl:attribute name="name"><xsl:value-of select="$anchor"/></xsl:attribute>
|
||||
<h2><xsl:value-of select="@title"/></h2>
|
||||
</a>
|
||||
|
||||
<xsl:apply-templates select="lv:group"/>
|
||||
|
||||
<p class="top"><a href="#">Top</a></p>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
Loading…
Reference in New Issue