Searching for a string in a xml field in xslt - xslt-2.0

I have a set of values like '0100','AD','0200'. I have a xml field ws:String1. I need to check this field for any one of the above 3 values, How do I do that in XSLT?
Thanks Martin. Your code worked, I had to add xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" and it took care of the syntax error. Thanks.

Related

How to check SVG file Validation?

While checking validation of SVG file, it showing error: Attribute data-name not allowed on SVG element pattern at this point.
Not able to resolve this issue.
The data-* attributes were first officially defined in the HTML5 standard as an HTML feature. The SVG 1.1 standard predates that by around 10 years. Data attributes have now been added to the SVG2 specification, but that is not yet an official specification.
The W3C SVG validator has not yet been updated to support SVG 2 documents. When it does, I expect it will not flag data attributes as an error. Until then, you should either remove the attributes, or ignore the validator errors.
According to SVG validation markup guide
For SVG-in-HTML, use HTML-style data attributes; any attribute name that starts with data- is for custom data. Beware: the matching dataset DOM property on the element object is new in SVG 2, and won’t be supported everywhere. Use getAttribute()/setAttribute() for best support.
i.e. Now data-pattern is no more supported. I have checked SVG by removing data-name & it is working normally w/o any error.
For the get/set attributes you need javascript help which I dont know but if you tell us why you need this tag may be we try to find some alternative that coukld help you around.
You have one warning No Character encoding declared at document level , which can be fixed by adding below line at top of your svg file.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Hope it helped anyhow.

HighRise API Create a person failing with missing first name while it's there

I'm trying to create a person in highrise using the API. I'm getting a "First name is missing. Contacts must have a name" error message in the response.
Here is my code:
let x = """<?xml version="1.0" encoding="UTF-8"?>
<person>
<first-name>name</first-name>
<last-name>last</last-name>
<contact-data>
<email-addresses type="array">
<email-address>
<address>someEmail#gmail.com</address>
</email-address>
</email-addresses>
</contact-data>
<tags type="array">
<tag>
<id type="integer">6154219</id>
<name>sometag</name>
</tag>
</tags>
</person>"""
let req = new RestRequest("/people.xml", Method.POST)
req.AddParameter("Content-Type", "application/xml")
req.AddParameter("application/xml", x, ParameterType.RequestBody)
let res = client.Execute(req)
The response returns a 422 Status code. Not sure what I'm doing wrong here?
Based on a similar StackOverflow question, it looks like you might get this error when there is something else wrong in your request, such as when it is missing the appropriate Content-Type.
I'm not familiar with Highrise or Restsharp to give a definite answer, but it seems that there might be something wrong with how you create the request. Just from reading your code, I find the use of AddParameter to add the body somewhat unexpected (even though it might be right). It looks like you might be able to use AddBody instead, so I'd try that.
(This is more of a comment than a proper answer, but it got too long to post it as a comment!)
I believe this is a result of attempting to add tags while creating the user. It's not at all clear from the API but at least in my experience no formulation of the tags field can be submitted with a company/person and succeed.
Alternatively, and I don't speak f# so I can't be sure, but the "Content-Type" is supposed to be in headers. Does the parameter component you're using add that explicitly as a header?
The missing name field showed up for me before I got the header working.
Turns out that you cannot add tags when creating a new person. It needs to added in a separate request after adding a contact. This is not explicitly mentioned in the documentation but can be concluded from their examples.

iOS SDK grab elements in xml code

I've search the web for a solution. I am developing an application that fetches some xml content from a webserver. I can run the xml code in a log and every thing is returned OK. So that is working.
My problem is when it is time to parse the xml. My xml code looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<Content>
<Name>
John Doe
</Name>
<Adress>
Road 123
</Adress>
</Content>
How can grab the Name and the adress element and put the string "John Doe" and "Road 123" inside a string.
I hope someone can help me because i am really confused :s
Duplicate of many many many questions...
Try googling "XML Parsing iOS" - in fact please try googling your problem before posting any question on Stack Overflow.
Anyway, I'll give you a clue - have a look at NSXMLParser

Sharepoint Lists.asmx: remove "ows_MetaInfo" field from GetListItems method response xml

The following question was posted in other forum, but there was no response, I am facing the same problem and I think it will get some answers here :
Question :
I am making use of the SharePoint 2007 GetListItems web service to programatically retrieve all documents within a document library. However, my program is throwing an Exception due to an invalid character contained within the XML response. The bad data is within the Word document itself. There are control characters within the Comments section of the document properties. The bad characters are then ending up as  in the ows_MetaInfo field in the XML output which is invalid.
I have no need for the ows_MetaInfo field and so I have been trying to use the viewFields parameter to specify which fields to return along with setting the query option IncludeMandatoryColumns to false but the ows_MetaInfo field is always returned.
Does anyone know if it is possible to remove the ows_MetaInfo field from the output or somehow handle these invalid characters that are appearing in the XML output
In my case (SharePoint 2010) this solved the problem:
<soap:viewFields>
<ViewFields Properties="True">
<FieldRef Name="MetaInfo" Property="ModifiedBy" />
<FieldRef Name="ID" />
<FieldRef Name="LinkFilename" />
</ViewFields>
</soap:viewFields>
This works for me to exclude the ows_MetaInfo field:
<soap:GetListItems>
<soap:listName>{....}</soap:listName>
<soap:viewFields>
<ViewFields Properties="True">
<FieldRef Name="*"/>
<FieldRef Name="MetaInfo"/>
</ViewFields>
</soap:viewFields>
</soap:GetListItems>
See also http://msdn.microsoft.com/en-us/library/dd964860(v=office.12).aspx
There are no way to remove this field from the output, or at least none that I've found.
The MSDN documentation says that even if you set the IncludeMandatoryColumns to false, it will returns some mandatory fields.
I think your best option here is to fill a bug report to Microsoft, saying that invalid characters are put inside the ows_MetaInfo field.
Another thing you can try, but I don't know if it will resolve the problem it setting the Properties attribute of the ViewFields element to TRUE.
<ViewFields Properties="TRUE">your fieldrefs</ViewFields>

BizTalk 2006 R2 mapping problem

I have this data (all the elements are optional):
<data>
<optionalElement1>...</optionalElement1>
<optionalElement2>...</optionalElement2>
<optionalElement3>...</optionalElement3>
</data>
I need to map this to another schema (all the elements are required):
<request>
<Element1>...</Element1>
<Element2>...</Element2>
<Element3>...</Element3>
</request>
Since the elements in the original request are optional, the mapping will
only generate the corresponding elements for the originally included
elements. But the validation of the request will fail.
Example:
<data>
<optionalElement3>
<value1>1</value1>
<value2>2</value2>
</optionalElement3>
</data>
will be mapped to
<request>
<Element3>
<subelement1>1</subelement1>
<subelement2>2</subelement2>
</Element3>
</request>
And the validation will fail because i'm missing Element1 and Element2. The
response should be (I think):
<request>
<Element1 xsi:nil="true" />
<Element2 xsi:nil="true" />
<Element3>
<subelement1>1</subelement1>
<subelement2>2<subelement2>
</Element3>
</request>
How can I do this in the mapping? How can I ensure that the element is
created in the output message?
And, by the way, if a subelement is not present (let's say
"data/optionalElement1/value1" how can I make sure that the destination
subelement "request/Element1/subelement1" is created?
Make it very simple. Use the xlst file for mapping.
Using simple if condition you can check for value exist for opetion element or not, if value exist then map that else map the null (Empty) value. So the complex element will get generated even if there is no value for optional element.
Hope it will solve your problem.
You can do all this in the mapper. I haven't been into Biztalk for a while and I don't have it near me, but I know there are functiods in the mapper that lets you check for the existence of the fields you need. Depending on the existence of these field, you can specify what the appropriate action for the mapper is.
You force the creation of fields by giving them default values in the target schema. This can also be done using the mapper, via the properties window.
Jose,
You'll want to look at the table looping functoid. Here's a post about it.
http://geekswithblogs.net/Chilberto/archive/2008/04/16/121274.aspx
Using this functoid with the table extraction should give you your solution. Also here's a good series on understadning the mapper.
http://www.bizbert.com/bizbert/2008/02/07/Understanding+The+BizTalk+Mapper+Part+1+Introduction.aspx
-Bryan

Resources