|
Use switch statement. Create one when for all null.
<xsl:choose>
<xsl:when test="not(Payer/Address/County='') and not(Payer/Address/State='') and not(Payer/Address/Province='')">
</xsl:when>
<xsl:when test="not(Payer/Address/County='') or not(Payer/Address/State='') or not(Payer/Address/Province='')">
<CtrySubDvsn>
<xsl:value-of select="Payer/Address/County" />
<xsl:value-of select="Payer/Address/State" />
<xsl:value-of select="Payer/Address/Province" />
</CtrySubDvsn>
</xsl:when>
</xsl:choose>
|
|
|
|
|
Hi Friends,
I have a scenario where need to generate WordProcessing Report
Here is my template sample below
First Name: «FirstName»
Last Name: «LastName»
Here First Name and Last Name are keys and corresponding Merge-fields are («FirstName» & «LastName»)
Now I have to generate a report where these key and merge-fields need to repeat number of times according to the Employee record. Example if there are fice employees in database, i need to show all five employees record one after other with FirstName and LastName in sequence.
I tried with below code. But this wont help because the key and data value does not show as per template configuration.
Can you please tell me how can i achieve this in C#?
Thanks in advance.
|
|
|
|
|
I have two elements in a XSLT
"/glcim:lcim/glcim:applicant-details/glcim:applicant-reference"
and
"/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"
I want to compare the value of these two elements and if they differ in value
i want to populate the value of glcim:applicant-reference_new into ApplicationId field
can i get an XSLT code for it please
Right now I have
<xsl:text> "RefId":"</xsl:text>
<xsl:value-of select="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference"/>
<xsl:text>",</xsl:text>
which populates the RefId with the value of /glcim:lcim/glcim:applicant-details/glcim:applicant-reference
But I would like to populate RefId with "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"
only if the values of glcim:applicant-reference_new differ from glcim:applicant-reference else Skip populating the Refid
ANy XSLT code would be greatly appreciated
|
|
|
|
|
Try:
<xsl:if test="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference != /glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new">
<xsl:text>"RefId":"</xsl:text>
<xsl:value-of select="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new" />
<xsl:text>",</xsl:text>
</xsl:if> <xsl:if> Element | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
when i opened the app, i dont see any webbrowser on my screen help! i just put a webbrowser.. no coding wwhy is it hidden??? i have check all!
|
|
|
|
|
|
Hello,
My office is using a schematron script that was created by an employee who does now work at our institution anymore. It was working fine until we upgraded to XMLSpy 2019. Then the scripts stopped working and we got error messages about not being able to retrieve the source (error message 1). When trying to validate the file that the schematron script is processing it does not validate as if the element declaration is not correct anymore (error message 2). Does anyone have any advices on how to fix it?
thanks,
Rachel
Error Message 1:
File S:\Metadata\Code\Schematron\Schematron_ETD.xsl: XSL transformation failed
Cannot retrieve resource 'S://Metadata/ETD/Staging/MODS/u0015_0000001_0003253.mods.xml'
Error location: xsl:stylesheet / xsl:template / xsl:for-each / xsl:apply-templates / <a href="https://www.codeproject.com/Members/select">@select</a>
Details
System Error 2: The system cannot find the file specified.
I/O Error 400: Don't know how to deal with relative URI (scheme name is missing).
I/O operation on file 'S:\\Metadata\ETD\Staging\MODS\u0015_0000001_0003253.mods.xml' failed.
FODC0002: Cannot use the URI supplied as the first argument to the 'doc' function, to retrieve a resource containing XML
Error message 2:
File S:\Metadata\ETD\Documentation\xmllists\20190605xmlList.xml is not valid.
File S:\Metadata\Code\Schematron\Schematron_ETD.xsl has errors.
Neither an element declaration nor a type definition is known for element <xsl:stylesheet>. Strict assessment failed.
Error location: xsl:stylesheet
Details
cvc-assess-elt.1: Neither an element declaration nor a type definition is known for element <xsl:stylesheet>. Strict assessment failed.
Neither an element declaration nor a type definition is known for element <xsl:import>. Strict assessment failed.
Error location: xsl:stylesheet / xsl:import
Details
cvc-assess-elt.1: Neither an element declaration nor a type definition is known for element <xsl:import>. Strict assessment failed.
Neither an element declaration nor a type definition is known for element <xsl:output>. Strict assessment failed.
Error location: xsl:stylesheet / xsl:output
Details
cvc-assess-elt.1: Neither an element declaration nor a type definition is known for element <xsl:output>. Strict assessment failed.
Neither an element declaration nor a type definition is known for element <xsl:template>. Strict assessment failed.
Error location: xsl:stylesheet / xsl:template
Details
cvc-assess-elt.1: Neither an element declaration nor a type definition is known for element <xsl:template>. Strict assessment failed.
Neither an element declaration nor a type definition is known for element <xsl:for-each>. Strict assessment failed.
Error location: xsl:stylesheet / xsl:template / xsl:for-each
Details
cvc-assess-elt.1: Neither an element declaration nor a type definition is known for element <xsl:for-each>. Strict assessment failed.
(and many pages more of this)
|
|
|
|
|
Member 14599986 wrote: Neither an element declaration nor a type definition is known for element <xsl:stylesheet>. Strict assessment failed.
That looks like the obvious place to start. Does your Schematron_ETD.xsl file have the correct xsl namespace declaration?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ...>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello!
I'm really desperate. I also googled and tried examples, which did not work in the end. I'm also a beginner in XML / Javascript and have very little XML knowledge. That's why I really ask for your help / explanation.
Following problem: I need an XML file that contains several images. In the HTML file, these images should then be read randomly from the XML file. Coincidentally in this sense, for example, that you specify 20 images in the XML file, but only 10 random images are displayed in the HTML file. I really do not know how to do that. I've also read websites, but I'm still not smart. I would be very happy about an example so that I understand it firstly and secondly apply it.
Besides, I do not know how to place these pictures in a particular place. It should be such that e.g. Image 1 is located at xy, while image 2 is to be displayed elsewhere on the site. How should I write the code so that it is output? Is that even possible?
I guess it will probably be easy, but I can not get on with it. I would be very happy to receive answers
|
|
|
|
|
XML is not an ideal vehicle for transmitting images, which would need to be encoded as some textual representation first. A better idea would be to use a database or just a directory with the images stored as files. As for displaying information via HTML/Javascript, you can find examples all over the internet. A good starting point would be W3Schools Online Web Tutorials[^]
|
|
|
|
|
Thank you for your answer! I have already implemented this with HTML and it works, but unfortunately it is required that the images can be read from an XML file. Something other than an XML file is not accepted. And that's my problem .. how could I solve this if nothing but an XML file is allowed?
|
|
|
|
|
|
Hi
I would like to query and display results from XML APIs (lINK) using Visual basic. I will have a search box with search parameters so the users can search the xml APi and get data displayed back on the browser or just the summary of the query indicating results so that users can click on the link and be redirected to the external site to view the details of their search,
similar to comparison sites... Could you please advise on the best solution and approach for this? any examples, tutorials or samples to try first, would be great
Thank in advance
|
|
|
|
|
hm9 wrote: the best solution and approach for this The obvious answer is: do some research, design, coding and testing. But it really is impossible to give a reasonable answer to such a wide question. Also we know nothing about your knowledge and skills. These forums are really for specific technical questions: How to get an answer to your question - XML / XSL Discussion Boards[^].
|
|
|
|
|
<xsl:if test="date">
<xsl:value-of select="date"/>
<xsl:text> • </xsl:text>
</xsl:if>
This is the code used in xsl file but the output showing Chinese month
|
|
|
|
|
There is no date conversion code in your question. All you're doing is copying the input value to the output, and appending some static text.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I am using a list of a class. Serialization works fine, but Deserialization leads to creating new lists, which are appended to main list. I.e. if Deflists in AllKeyList contains 5 KeyDefinition Classes, after Deserialization there are 10.
How can I force overriding?
Thx adv for your help.
What I'm doing:
FileStream fs = new FileStream(sFile, FileMode.Open);
var x = new System.Xml.Serialization.XmlSerializer(Setup.GetType());
var settings = new XmlReaderSettings { CheckCharacters = false, };
try
{
Setup = (DataSettings)x.Deserialize(fs);
Console.WriteLine("XML Read {0} erfolgreich", sFile);
Data structure:
public class KeyDefinition
{
public string Name { get; set; }
public string KeyType { get; set; }
public List<FieldToken> KeyDef { get; set; }
....
}
public class AllKeyList
{
public List<KeyDefinition> DefLists { get; set; }
...
}
modified 17-Jul-18 5:00am.
|
|
|
|
|
Hello all,
I just started learning HTML and I would like to save the value entered to a selected data list option.
<pre>
<!DOCTYPE html>
<html>
<head>
<title>Program using HTML </title>
<body bgcolor="LightGray" text="Black">
<form name="NUM">
<input list="document">
<datalist id="document">
<option value="wireset_623101">
<option value="wireset_623102">
<option value="wireset_623103">
<option value="wireset_623104">
<option value="wireset_623105">
<option value="wireset_623106">
<option value="wireset_623107">
<option value="wireset_623108">
<option value="wireset_623109">
<option value="wireset_623110">
<input value="button">
</datalist>
= <input name="number">
<br>
<input type="button" value=" 1 " onClick="document.NUM.number.value+='1'">
<input type="button" value=" 2 " onClick="document.NUM.number.value+='2'">
<input type="button" value=" 3 " onClick="document.NUM.number.value+='3'">
<button type="button" onclick="document.write(document.NUM.number.value +' wireset_623101')">NEXT></button>
<br>
<input type="button" value=" 4 " onClick="document.NUM.number.value+='4'">
<input type="button" value=" 5 " onClick="document.NUM.number.value+='5'">
<input type="button" value=" 6 " onClick="document.NUM.number.value+='6'">
<button type="button" onclick="document.write(document.NUM.number.value +'wireset_623110' )">ENTER</button>
<br>
<input type="button" value=" 7 " onClick="document.NUM.number.value+='7'">
<input type="button" value=" 8 " onClick="document.NUM.number.value+='8'">
<input type="button" value=" 9 " onClick="document.NUM.number.value+='9'">
<br>
<input type="button" value=" 0 " onClick="document.NUM.number.value+='0'">
</form>
<script>
</script>
</head>
</body>
</html>
|
|
|
|
|
Hello,
I need to validate an XML file using an XSD scheme imposed by a provider.
For that I use the library libxml2 version 2.9.4 and msxml6 under Windows and I get different results.
With libxml2 the XML file is not valid on Windows or Linux.
With MSXML6 the XML file is considered valid.
Below are some simplified examples. To easily validate the XML file with the XSD, I use Microsoft Visual Studio (msxml) and compare with Notepad ++ (XMLTools plugin that apparently uses libxml2).
XML file :
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:root="http://www.xmlValidation.com/root" xsi:schemaLocation="./schema_strict.xsd">
<object identifier="1ABC001DE"/>
</root>
XSD file :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="codeType">
<xs:attribute name="identifier" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:maxLength value="10"/>
<xs:pattern value="\d\p{Lu}\p{Lu}\p{Lu}\d\d\d\p{Lu}\p{Lu}(\p{Lu}|\d|)"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="object" type="codeType" minOccurs="0">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
By adding a "?" at the end of the control pattern, the validation is ok with libxml and msxml: \d\p{Lu}\p{Lu}\p{Lu}\d\d\d\p{Lu}\p{Lu}(\p{Lu}|\d|)?
Not at all comfortable with regular expressions and XSDs I need help on this topic.
Do you think that libxml is stricter than msxml? is the interpretation of the regular expression ambiguous?
Thank you very much !
|
|
|
|
|
The question mark makes the preceeding portion optional. That is it might be absent or present one time but not multiple times.
But you have an empty OR condition:
(\p{Lu}|\d|) I would change it to
(\p{Lu}|\d) I guess that the regex implementation used by libxml fails here while those of MSXML ignores it.
|
|
|
|
|
I am using XmlElements and AppendChild to create an XML tree. Now, the first level from the root writes on a new line but all other XmlElements write on the same line. How do I get each new XmlElement to write on a new line with proper indentation?
My code:
XmlAttribute ApplicantAttribute = doc.CreateAttribute("UserId");
ApplicantAttribute.Value = NumberGenerator(100000, 999999, 6);
Applicant.Attributes.Append(ApplicantAttribute);
XmlNode ssnNameNode = doc.CreateElement("SSN");
ssnNameNode.AppendChild(doc.CreateTextNode(NumberGenerator(0, 999999999, 9)));
Applicant.AppendChild(ssnNameNode);
XmlNode aNameNode = doc.CreateElement("Name");
aNameNode.AppendChild(doc.CreateTextNode("Place Holdor Name"));
Applicant.AppendChild(aNameNode);
XmlNode demDataNode = doc.CreateElement("DemographicData");
demDataNode.AppendChild(doc.CreateTextNode("DemographicData"));
aNameNode.AppendChild(demDataNode);
XmlNode FullName = doc.CreateElement("FullName");
FullName.AppendChild(doc.CreateTextNode("FullName"));
demDataNode.AppendChild(FullName);
XmlNode LegalName = doc.CreateElement("LegalName");
LegalName.AppendChild(doc.CreateTextNode("LegalName"));
FullName.AppendChild(LegalName);
XmlNode Last = doc.CreateElement("Last");
Last.AppendChild(doc.CreateTextNode("Last"));
LegalName.AppendChild(Last);
XmlNode First = doc.CreateElement("First");
First.AppendChild(doc.CreateTextNode("First"));
LegalName.AppendChild(First);
Applicant.AppendChild(demDataNode);
RequestNode.AppendChild(Applicant);
The problem is that the output writes the following Xml file:
<Applicant UserId="830046">
<SSN>811163249</SSN>
<Name>Place Holdor Name</Name> <DemographicData>DemographicData<FullName>FullName<LegalName>LegalName<Last>Last</Last><First>First</First></LegalName></FullName></DemographicData>
</Applicant>
|
|
|
|
|
Doesn't matter if xml nodes are in the same line untill the xml is well formatted.
|
|
|
|
|
Bootzilla33 wrote:
I asked this question in another thread but no one answered it so I'm creating a new thread to see if someone can help. I need help with pass the value in the API to XElement in C#
Here the a piece of the API schema:
<xsd:element
name="EventStatus" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Event Status</xsd:documentation>
</xsd:annotation>
</xsd:element>
Is this how that would be done?
new XElement("EventStatus", "Event Status"),
), |
|
|
|
|
|
Your question is not very clear, but I assume you want to create an XElement that when written to a file will look like this
<xsd:element name="EventStatus" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Event Status</xsd:documentation>
</xsd:annotation>
</xsd:element>
This is one way to do it.
XNamespace ns = "should probably be the XSD namespace";
XElement documentation = new XElement(ns + "documentation");
documentation.SetValue("Event Status");
XElement annotation = new XElement(ns + "annotation");
annotation.Add(documentation);
XElement eventStatus = new XElement(ns + "element");
eventStatus.SetAttributeValue(XName.Get("name"), "EventStatus");
eventStatus.SetAttributeValue(XName.Get("type"), "xsd:string");
eventStatus.Add(annotation);
XElement root = new XElement("root", new XAttribute(XNamespace.Xmlns + "xsd", ns));
root.Add(eventStatus);
string s = root.ToString();
|
|
|
|
|
Hi,
I make my question after some research in web without any clear response to my problem.
I have the following XML and I need to apply an XSL transformation to get only nodes which haven't child.
Input :
<Root_Element Att_Name="XXX">
<right Id="100">
<right Id="110" />
<right Id="111">
<right Id="112" />
<right Id="113">
<right Id="114" />
<right Id="115" />
</right>
<right Id="116" />
</right>
<right Id="117">
<right Id="118" />
<right Id="119">
<right Id="120" />
<right Id="121" />
</right>
</right>
</right>
</Root_Element>
Expected output :
<Root_Element Att_Name="XXX">
<right Id="110" />
<right Id="112" />
<right Id="114" />
<right Id="115" />
<right Id="116" />
<right Id="118" />
<right Id="120" />
<right Id="121" />
</Root_Element>
|
|
|
|