|
Thanks but it is still not removing span tags.
|
|
|
|
|
What software or API are you using? Could you provide a snippet of your code and data?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Well basically its a search engine powered by vivisimo. i am using vivisimo admin tool to boost certail result.
For instance:-
<xsl:template match="/">
<scope>
<xsl:copy-of select="/scope/attribute" />
<boost name="df" />
<xsl:apply-templates />
</scope>
</xsl:template>
<xsl:template match="document">
<document url="{@url}">
<xsl:if test="viv:test(content[@name='snippet'], 'heart', 'case-insensitive-regex')">
<xsl:attribute name="boost-name">df</xsl:attribute>
<xsl:attribute name="boost-display">boost-and-list</xsl:attribute>
</xsl:if>
<xsl:copy-of select="@*" />
<xsl:copy-of select="* | text() | comment()" />
</document>
</xsl:template>
The above code boost the result with heart word in snippet after any search made.
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="boost" mode="list-boost-custom">
<fieldset style="border: 2px solid orange">
<legend style="font-size: 120%; color: #555">Good Choices:</legend>
<ul style="list-style-type:none; padding: 0 0.5em">
<xsl:for-each select="document">
<li style="margin: 0.5em 0;">
<span>
<a href="{@url}">
<xsl:value-of select="content[@name='title']" />
</a>
</span>
</li>
</xsl:for-each>
</ul>
</fieldset>
</xsl:template>
The above code provide a column for a good choices where the boosted result titles are displayed. Now everything is working fine. I am getting the titles but along with the titles i am also getting span tag as i mentioned before but yeh few of the titles are fine but most of them contain this span tag several times.
Any idea about this ??
Also i would like to ask if there is any way i can also include image along with the title, may be below title (if there is image included with the the boosted page)
Thanks
Andyyy
modified on Tuesday, January 20, 2009 5:12 AM
|
|
|
|
|
I am not at all familiar with Vivismo. However, the first code snippet contains the following:
<xsl:copy-of select="@*" /><xsl:copy-of select="* | text() | comment()" />
This code copies everything. The second code snippet actually has a span tag in the code. Wouldn't that span tag get copied to the output?
<li style="margin: 0.5em 0;"><span><a href="{@url}"><xsl:value-of select="content[@name='title']" /></a></span></li>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
You don't have to know the vivisimo for this i reckon.
If i remove the first line of code. I don't get any web page detail like title, snippet etc but i do get only the link (For instance when you search in google, imagine if it gives you result without any title or any discription below that but just a NO Title option to click and get to that page)
And i have already tried removing span tag from the second line of code but it doesn't make any difference really.
I think the main problem is with the display code. If you come up with your own code which can do similar stuff but without span tag then it would be great.
Here is one link which do something similar. But i can't figure out how to use it in my code.
http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2008/08/30/strip-out-html-tags-to-display-plain-text-in-xslt.aspx[^]
|
|
|
|
|
When I come home from work, I will take a look at this.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
Any luck with it so far ? Also i am wondering if there is any way i can extract the image from the html web page and change its dimensions and display it next to the search result.
Thanks
Andyyy
|
|
|
|
|
Hi all
I am looking at XML Serialization at the moment, most of it is pretty straight forward [so far]. I am after creating my own employee class that I am configuring for XML serialization,
1. declaring it as a Public class,
2. making all necessary variables Public and
3. adding a Parameterless constructor.
When I was looking into BinaryFormatter and SoapFormatter, to handle Deserialization I had to implement the interface IDeserializationCallback and then create a method that implements IDeserializationCallback.OnDeserialization to populate any temporary variables. How do I do this with XML Serialization?
The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized.
Michael.
|
|
|
|
|
mike123543 wrote: The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized
And have you tried that?
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
IDeserializationCallback does not seem to be available to me when using XML serialization. It would appear to be only available to SoapFormatter, BinaryFormatter or when completing Custom Serialization.
This issue would only arise if I needed to customise the xml serialization, I can always rely on the standard Custom Serialization.
Michael.
|
|
|
|
|
mike123543 wrote: This issue would only arise if I needed to customise the xml serialization
This is true.
Try this book, Chapter 7 to start[^]
It is really thorough.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
how to read or write to xml file?
|
|
|
|
|
There are many ways to do it.
You can use XmlTextReader, XmlNodeReader for reading the XML.For,writing ,you can use XmlTextWriter and XmlNodeWriter classes.There is also XmlDocument class,you can use for reading and writing purpose.
Check it[^]
Cheers!!
Brij
|
|
|
|
|
|
hi guys,
i want to know how i can check the <code>validate </code>of the following schema , i test it in this site http://www.validome.org/grammar/ but give me error,so what is the steps to validate this doc ?
====================================================
An xml Schema:
====================================================
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified"
<xs:element name="note">
<xs:complextype>
<xs:sequence>
<xs:element name="to" type="xs:string" />
<xs:element name="from" type="xs:string" />
<xs:element name="heading" type="xs:string" />
<xs:element name="body" type="xs:string" />
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:schema>
=================================================
A Reference to an XML Schema
=================================================
<note>
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd"
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<div class="ForumMod">modified on Wednesday, January 7, 2009 9:12 AM</div>
|
|
|
|
|
Honeyboy_20 wrote: i test it in this site http://www.validome.org/grammar/ but give me error
What was the error?
How on earth do you expect anyone to help you without full information?
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
Hi,
I need to pass Html code in one of the xml tags but i am having a problem when trying to parse the xml code. I tried replacing the < and > with & lt; and & gt; (with no spacing) but all in vain. I am parsing the code with javascript functions. Does anyione a way by which i can solve this problem please? Thanks for your time
|
|
|
|
|
Use a CDATA section
only two letters away from being an asset
|
|
|
|
|
Hi,
I am trying a sample program...to create source code from a simple flow chart prepared in visio(not UML models). Please give me any ideas, to start it or let me know are there any tools available to do my job.
Thanks in advance
By,
sree
sree
|
|
|
|
|
hi ,
i want to understand the contents of schema ?
Code:
<schema xmlns=""http:
targetNamespace="http://www.example.com/name"
elementFormDefault="qualified">
<element name=""name""></element>
i know why i use namespace "xmlns=”http://www.w3.org/2001/XMLSchema" but what is this mean "xmlns:target=”http://www.example.com/name”" and what is targetNamespace and the difference between it and normal namespace ? and also what is mean by "elementFormDefault=”qualified”" i read that u can modify the default specifying how element should be qualified but i can not understand what is the effect of it if i add it in my schema? plz give me simple explain if u can help me.
|
|
|
|
|
|
Happy New Year,
Strange one to start the year off, any help would be appreciated.
I have a Winform Project calling a web service. passing in an XML string.
When I pass through my XML to the webservice, it works fine and gets inserted into the dataset without a problem, however as soon as I include an email address within the XML the dataset does not create correctly?
Dim strXML As String = "<parameters><parameterline><details><machineid>Pal0066</machineid><printer>Printer1</printer><username>TomUser</username>"
strXML &= "<reportname>CanteenBilling</reportname><receiptmethod>Email</receiptmethod><format>PDF</format>"
strXML &= "<emailto>email@problemishere.co.uk</emailto><emailcc></emailcc><emailbcc></emailbcc><emailsubject></emailsubject>"
strXML &= "<emailbody></emailbody></details><reportparameters><location>1</location></reportparameters></parameterline></parameters>"
ConvertXMLIntoDS(StrXML)
Private Function ConvertXMLIntoDS(ByVal strXML As String) As Data.DataSet
Dim ds As New Data.DataSet
Dim reader As System.IO.StringReader
Try
reader = New System.IO.StringReader(strXML)
ds.ReadXml(reader)
ConvertXMLIntoDS = ds
Catch ex As Exception
'RunReports.AddLog("ConvertXMLIntoDS - Error")
'RunReports.AddError(ex, methodBase.Name)
Finally
If Not IsNothing(ds) Then
ds.Dispose()
ds = Nothing
End If
If Not IsNothing(reader) Then
reader.Dispose()
reader = Nothing
End If
End Try
End Function
|
|
|
|
|
tomkettering wrote: the XML the dataset does not create correctly?
"does not create correctly" means what?
The following C# produces the email address as expected.
string sxml = "<root><mail>hello@mymail.com</mail></root>";
DataSet ds = new DataSet();
ds.ReadXml(new System.IO.StringReader(sxml));
Console.WriteLine(ds.Tables[0].Rows[0].ItemArray[0].ToString());
led mike
|
|
|
|
|
|
hi all
I want to generate the .xsd for xml document
the format of xml would be say
<menu>
<mainmenu>
<childmenu> ///optional 0 to n
<submenu />
.
.
.
<childmenu>....
</childmenu>
<submenu>
.
.
.
</submenu></childmenu></mainmenu>
.
.
.
.
</menu>
|
|
|
|