|
I found that the problem is not with "%". The values is having extra spaces as " 10.34%"
So the below expression is not working.
"/Data/page/content[.='10.34%']".
its working with the expression "/Data/page/content[.=' 10.34%']".
Please guide me to solve this issue. Thanks in advance
<Data>
<page>
<content> 10.34%</content>
</page>
</Data>
|
|
|
|
|
Issued solved with the below expression
"/Data/page/content[normalize-space(.)='10.34%']".
|
|
|
|
|
Hello
I have question how can I put condition in my programming in windows phone application?
for example, if I want but code for help user when use my application the users cannot add number more than 80 in text box how I do it ?
Could you please help me !!!!
Kind regards
|
|
|
|
|
Sounds like you are trying to add range validation to a textbox, but I doubt you are working with XML/XSL. See the forum list to find the forum appropriate for your question. Or you can ask a question in the general "Quick Answers" forum.
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
You could have posted this in a C# forum, you can get an answer much quciker than here. Make sure you are in the right place before posting a question.
Try this:
try
{
Int32 number = Int32.Parse(txtBoxId.Text);
if(number <= 80)
{
}
else
{
}
}
catch(Excemption e)
{
throw new Excemption("Not a valid interger!");
}
That's a basic function you need, you can call this function on your desired textbox events e.g. on onkeypress.
Hope this helps,
Morgs
|
|
|
|
|
|
Hi, I am having a problem in displaying XML in HTML as shown below -
XML:-
<ABC>
<DEF>
<GHI>Heading</GHI>
<P/> Hello, How are you?
<P/> I am a Developer.
</DEF>
</ABC>
XSLT:-
?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>xml to html</h2>
<table border="0">
<xsl:for-each select="ABC/DEF">
<tr>
<td><xsl:value-of select="GHI" /></td><br/>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
OUTPUT -
Heading
HeadingHello, How are you?I am a Developer.
I want Heading to be in line 1 and then a line break and then comes paragraph. Also i want a space/line break between two paragraphs.
How to get following output instead -
Heading
Hello, How are you?
I am a Developer.
Thanks
Andyyy
|
|
|
|
|
Your HTML is faulty.
<table>
<xsl:for-each select="ABC/DEF">
<tr><td><xsl:value-of select="GHI"/></td></tr>
<xsl:for-each select="p">
<tr><td>
<xsl:value-of select="."/>
</td></tr>
</xsl:for-each>
</xsl:for-each>
</table>
You're using columns (TD) instead of rows (tr).
Also, change your XML to:
<GHI>Heading</GHI>
<p>Hello, How are you?</p>
<p>I am a Developer.</p>
|
|
|
|
|
Thanks for your reply.
I agree with you about HTML part.
But this part of your suggested code doesn't work as it doesn't display paragraphs -
<xsl:for-each select="p">
<tr><td>
<xsl:value-of select="."/>
</td></tr>
</xsl:for-each>
The problem is, i have received XML from third party and there are hundreds of XML that needs to be displayed on webpage and everywhere they have used
<p/>
Paragraph 1
<p/>
Paragraph 2
So should i ask the client to produce XML correctly or is there any work around to be able to display each paragraph in separate line.
Thanks
|
|
|
|
|
You need to identify the inline paragraph and break up the output based on this. I'm platying with the idea but am getting stuck around mixing up carriage returns and line feeds, grrr!
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
|
|
|
|
|
If you can get them to parse it correctly, great. Otherwise, try yours again with the right HTML code to see if it can work. I wasn't able to get it myself.
|
|
|
|
|
Have you tried something like this:
<xsl:template match="*|text()">
<xsl:value-of select="."/>
</xsl:template>
And then where you have this:
<xsl:for-each select="ABC/DEF">
<tr>
<td><xsl:value-of select="GHI" /></td><br/>
<td><xsl:value-of select="." /></td>
</tr>
replace the second
<td> line:
<td><xsl:apply-templates/></td>
Edit: sorry, fixed the formatting
|
|
|
|
|
Thanks,
Just tried it but doesn't work -
Here is the html/javascript I am using to call xml and xsl - just incase there is some problem in script instead:-
<html>
<head>
<script type="text/javascript">
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}
function displayResult()
{
xml=loadXMLDoc("test.xml");
xsl=loadXMLDoc("test.xsl");
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
</script>
</head>
<body onLoad="displayResult()">
<div id="example" />
</body>
</html>
Thanks
|
|
|
|
|
The below is not perfect but is getting there. Unfortunately I need to leave the office soon but hope it helps...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Updated Template</title>
</head>
<body>
<table border="0">
<xsl:for-each select="ABC/DEF">
<tr>
<td><xsl:value-of select="GHI" /></td>
</tr>
<tr>
<td>
<xsl:variable name="inStr" select="."></xsl:variable>
<xsl:variable name="outStr">
<xsl:call-template name="template2">
<xsl:with-param name="parameter2" select="$inStr"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="$outStr"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
<xsl:template name="template2">
<xsl:param name="parameter2"/>
<xsl:choose>
<xsl:when test="contains($parameter2,'')">
<xsl:value-of select="substring-before($parameter2,'')"/><p/>
<xsl:call-template name="template2">
<xsl:with-param name="parameter2">
<xsl:value-of select="substring-after($parameter2,'')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$parameter2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
|
|
|
|
|
Thanks goblinTech,
It's getting there - output am getting is
Heading
Heading
Hello,
How
are
you?
I
am
a
Developer.
I will keep trying.
Thanks for your help.
|
|
|
|
|
You would find this so much easier if your xml was actually xml rather than just having a .xml extension and being a mixture of xml, html and plain text.
I would just tell the client to supply proper input if they want proper output. But then I tend to work for captive clients which makes life a lot easier.
Every man can tell how many goats or sheep he possesses, but not how many friends.
|
|
|
|
|
You are absolutely right. I just tried placing proper p tags and tried Bassam Abdul-Baki's solution and that works like a charm.
It's just this
<p/> , that's causing problem.
I just wanted to give it a go, if it's easily doable before I go back to my boss and suggest him to ask the client to provide proper XML and I have already wasted enough of my time.
Will try for another 30 mins and then no chance..
|
|
|
|
|
Even if you get it to work, you should let your boss know that the XML was not well-formed so that they fix it for future usage. The tags in XML are there for a reason. You shouldn't have to say I want the text after the empty tag when technically the empty tag was meant to be just empty.
|
|
|
|
|
just read the specification and it's written
DATA FORMAT
Available in XML valid against a Datapharm DTD
I am not sure how it's valid against DTD, when it's not well formed.
|
|
|
|
|
|
Well the thing is it is proper XML, it's just not very suitable for converting to HTML.
Get the sender to fix it. Or pass it through a filter of some sort.
|
|
|
|
|
HTML5 now makes the quotes around the attribute optional. It seems like a good idea, because they're just bloating the file most of the time. Of coarse, it's not official xml then, but who cares if it's just an internal file.
|
|
|
|
|
i was mading xml file for rss.
but I can see only 3 elements in rss reader program.
what is problem?
I think that xml format is fine.
="1.0"
<rss version="2.0">
<channel>
<title>회사명</title>
<link >http://nhn.com</link >
<language >ko</language >
<copyright >Copyright (c) by KoreaZinc, Inc. All rights reserved</copyright >
<pubDate >2011-08-08 오전 10:36:09</pubDate >
<lastBuildDate >2011-08-08 오전 10:36:09</lastBuildDate >
<description >회사명 보도자료 Rss 입니다.</description >
<image>
<title>회사명 보도자료 소식</title>
<url>http://nhn.com</url>
<link>http://nhn.com</link>
</image>
<item>
<title>회사명 회장</title>
<link>http://naver.com</link>
<description>출처:한국경재 회사명 회장</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>회사명 창업</title>
<link>http://daum.net</link>
<description>출처:메일신문 회사명 창업</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>1</title>
<link>http://daum.net</link>
<description>출처:메일신문1 1</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>2</title>
<link>http://daum.net</link>
<description>출처:2 2</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>3</title>
<link>http://daum.net</link>
<description>출처:3 3</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>4</title>
<link>http://daum.net</link>
<description>출처:4 4</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>5</title>
<link>http://daum.net</link>
<description>출처:5 5</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>6</title>
<link>http://daum.net</link>
<description>출처:6 6</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>7</title>
<link>http://daum.net</link>
<description>출처:7 7</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>8</title>
<link>http://daum.net</link>
<description>출처:8 8</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>9</title>
<link>http://daum.net</link>
<description>출처:9 9</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>10</title>
<link>http://daum.net</link>
<description>출처:10 10</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
</channel>
</rss>
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
This is a long shot, but could it have anything to do with you mixing the fonts? Note that there happen to be 3 items before the titles switch to Roman/ASCII characters.
Barring that possibility, perhaps if you indicate which 3 items are showing, that would help.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hi
I know I have seen this somewhere before, but I cannot find it again. I need an example of calling an xsd file from within another xsd. This is quite useful where a number for xml files are being generated, but where there is large common areas between these xml files being validated. In that scenario, it is useful to have an xsd that validates the parts common to all xml files, then have separate smaller xsd validation files for the parts of the xml that are specific to each xml file.
Thanks
|
|
|
|