|
Can you tell us what you are using to create the xml? Basically your problem is that an xml document can only have one root node so - <root><node><root><node> is invalid. The valid way to store two nodes would be - <root><node><node>
|
|
|
|
|
im using C# the basic problem is im having probem in appending the file it cant take one more than one data once i dono how to file n XML document if i wana add more than one data at once it doesnt allow me to append the file cuz the root tag is being repeated.. i wana create a dictionar in XML format in order to create that dictionary i m using text boxes, radio buttons check boxes it does store that data as tags in file but dsnt store multiple data
thanks for ur reply
regards
Bia
-- modified at 7:53 Monday 17th July, 2006
|
|
|
|
|
Hi guys,
i am transforming an file called XMLFile.xml along with the appropriate xslt file
like this:
XPathDocument surveyDoc = new XPathDocument(Server.MapPath("XMLFile.xml"));
// Load the xslt to do the transformations
XslTransform transform = new XslTransform();
transform.Load(Server.MapPath("dynamicControls.xslt"));
// Get the transformed result
StringWriter sw = new StringWriter();
transform.Transform(surveyDoc, null, sw);
But the xmlfile.xml contents are like:
<formname name="BusinessUnit">
details
followed by another form details.
<formname name="foreign unit">
details
so i want to specify the required formname in new XPathDocument=(Server.MapPath("XMLFile.xml")); //i.e BusinessUnit for ex: not the entire
xml file how can i pass only the required xml content(i.e only a part of the xml file containing required form details) want for transformation.I.e i dont want to transform foreign unit part also within the xml file.Please throw some light on this.
Thks in advance,
-- modified at 9:48 Sunday 16th July, 2006
|
|
|
|
|
Hi,
I have a problem when working with Mobipocket Creator (e-book publishing soft.)
I am making a custom dictionary.
I have an access db which I plan to output to xml file with structure like that:
In definition field, there will be more lines of text/<BR> tags or whatever else but I need that the final html file has those definitions multiline - I need to preserve multiline character of that field.
Thanks very much for your help.
<?xml version="1.0"?>
<!-- This file contains the structure of the sample dictionnary
The tags in this document are independent from the MobiPocket compiler tags
-->
<dictionary>
<word>
<orth>chair</orth>
<id>1</id>
<definition>
LINE1
LINE2
LINE3</definition>
<gramgrp>noun</gramgrp>
<infl>chairs</infl>
<usage>standard
</usage>
<etymology>from Latin "cathedra"</etymology>
</word>
</dictionary></pre></code>
then I have an xsl file:
<?xml version="1.0" ?>
<!-- This xsl file is used as a parser for the file "dictionary.xml". It used to produce an html file and
to transform tags present in "dictionary.xml" into MobiPocket tags.-->
<xsl:stylesheet version="2.0" xmlns:idx="www.mobipocket.com" xmlns:mbp="www.mobipocket.com" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:output method="xml"/>
<!-- Main Template -->
<xsl:template match="dictionary">
<html>
<body>
<mbp:pagebreak/>
<mbp:frameset>
<mbp:pagebreak crossable="no"/>
<xsl:for-each select="word">
<idx:entry name="word" scriptable="yes">
<xsl:attribute name="id">
<xsl:value-of select="id" />
</xsl:attribute>
<b><idx:orth><xsl:value-of select="orth"/></idx:orth></b>
<br/>
<xsl:value-of select="definition"/><br/>
<idx:string name="usage">
<xsl:attribute name="value">
<xsl:value-of select="usage" />
</xsl:attribute>
</idx:string>
usage : <xsl:value-of select="usage"/><br/>
<mbp:pagebreak/>
<br/>
</idx:entry>
<mbp:pagebreak crossable="no"/>
</xsl:for-each>
</mbp:frameset>
<xsl:apply-templates select="word"/>
</body>
</html>
</xsl:template>
<!-- Sub Templates -->
<!-- when a match is found for "orth" or "id" or "infl" or "gramgrp" or "etymology" or "definition",
this template is used to indicate that nothing has to be done-->
<xsl:template match="orth|id|infl|usage|gramgrp|etymology|definition"/>
</xsl:stylesheet>
In definition field, there will be more lines of text/<BR> tags or whatever else but I need that the final html file has those definitions multiline - I need to preserve multiline character of that field.
Thanks very much for your help.
-- modified at 8:24 Saturday 15th July, 2006"/>
<xsl:for-each select="word">
<idx:entry name="word" scriptable="yes">
<xsl:attribute name="id">
<xsl:value-of select="id" />
</xsl:attribute>
<b><idx:orth><xsl:value-of select="orth"/></idx:orth></b>
<br/>
<xsl:value-of select="definition"/><br/>
<idx:string name="usage">
<xsl:attribute name="value">
<xsl:value-of select="usage" />
</xsl:attribute>
</idx:string>
usage : <xsl:value-of select="usage"/><br/>
<mbp:pagebreak/>
<br/>
</idx:entry>
<mbp:pagebreak crossable="no"/>
</xsl:for-each>
</mbp:frameset>
<xsl:apply-templates select="word"/>
</body>
</html>
</xsl:template>
<!-- Sub Templates -->
<!-- displays a Thesaurus page with its own frameset-->
<!-- when a match is found for "thesaurus" the following instructions will be executed-->
<xsl:template match="thesaurus">
<idx:ext-subentry name="thesaurus">
<xsl:attribute name="extends">
<xsl:value-of select="../id" />
</xsl:attribute>
<xsl:value-of select="."/>
</idx:ext-subentry>
<xsl:call-template name="top_frame_thesaurus" />
</xsl:template>
<!-- when a match is found for "orth" or "id" or "infl" or "gramgrp" or "etymology" or "definition",
this template is used to indicate that nothing has to be done-->
<xsl:template match="orth|id|infl|usage|gramgrp|etymology|definition"/>
<!-- displays the bottom frame of the main frameset - The javascript functions are defined in the file CoverPage.html -->
<xsl:template name="bottom_frame">
<mbp:slave-frame display="bottom" device="all" breadth="auto" leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0">
<div align="center" bgcolor="yellow"/>
<a onclick="f_on_usage()">usage</a><xsl:text> </xsl:text>
<a onclick="f_on_etymology()">etymology</a><xsl:text> </xsl:text>
<a onclick="f_on_thesaurus()">thesaurus</a>
</mbp:slave-frame>
</xsl:template>
<!-- displays the top frame of the main frameset -->
<xsl:template name="top_frame">
<mbp:slave-frame display="top" device="all" breadth="auto" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center" bgcolor="blue">
<h3><font color="white"> Dictionary </font>
</h3>
</div>
</mbp:slave-frame>
</xsl:template>
<!-- displays the top frame of the Thesaurus page -->
<xsl:template name="top_frame_thesaurus">
<mbp:slave-frame display="top" device="all" breadth="auto" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center" bgcolor="green">
<h3><font color="white"> Thesaurus Dictionary </font>
</h3>
</div>
</mbp:slave-frame>
</xsl:template>
</xsl:stylesheet>
-- modified at 11:12 Saturday 15th July, 2006
|
|
|
|
|
Hi all,
Just as i thought i had it all figured out...
I want to create a table in fop with all the columns next to each other... as the columns reach the end of the page i want to create a new row. I thought i knew how to do this... just add a counter and if the counter reaches a certain amount, insert a new row. But the problem is this:
<xsl:for-each select="TableInfo">
<fo:table-row><xsl:variable name="counter" select="0"/>
<xsl:if test="ClientTitle"><xsl:variable name="counter" select="1+$counter"/>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
Client Title:
</fo:block>
</fo:table-cell>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientSurname"/>
</fo:block>
</fo:table-cell>
</xsl:if>
<xsl:if test="ClientName"><xsl:variable name="counter" select="1+$counter"/>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
Client Name:
</fo:block>
</fo:table-cell>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientName"/>
</fo:block>
</fo:table-cell>
</xsl:if>
<xsl:if test="ClientSur"><xsl:variable name="counter" select="1+$counter"/>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
Client Surname:
</fo:block>
</fo:table-cell>
<fo:table-cell font-size="8pt" border="1" border-color="black" border-style="solid" padding="2pt">
<fo:block>
<xsl:value-of select="ClientSur"/>
</fo:block>
</fo:table-cell>
</xsl:if>
</fo:table-row>
</xsl:for-each>
He who laughs last...
|
|
|
|
|
So... What i wanted to do...
I wanted to say right after i closed each cell...
<xsl:if test="$counter = 2"></fo:table-row><fo:table-row></xsl:if>
but then i realized i can't... i have to close the "last opened, first closed" tag...
so yet again i don't know how to go to a new row if the cells reach the end of the page.
He who laughs last...
-- modified at 4:12 Friday 14th July, 2006
|
|
|
|
|
I wanted to change to cursor when it goes over an element in SVG document, I tried to set cursor="wait" attribute within that element, but it didn't work. How could I do so then .. I wanted to change the cursor when I am dragging the svg element too.. any suggestion ? And I am using IE as the browser to display the SVG.
|
|
|
|
|
I have an XML file which stores information of authors and books written by them.
The following XQuery returns me a list of authors:-
<results>
{
for $b in doc("http://www.bn.com/bib.xml")//author
return
<result author="{$b/last | $b/first}" ></result>
}
</results>
However the resultset returned is:-
- <results>
<result author="Stevens W." />
<result author="Stevens W." />
<result author="Abiteboul Serge" />
<result author="Buneman Peter" />
<result author="Suciu Dan" />
</results>
(since there could be more than 1 book written by an author)
How do I change the above query to filter out duplicates?
I saw a few sites which suggested using 'intersect'.I also came across the
distinct-values function
But I do not know how to use it in this example.
Pls suggest
-- modified at 7:47 Thursday 13th July, 2006
|
|
|
|
|
Got it with "distinct-values"
<results>
{
let $a := doc("http://www.bn.com/bib.xml")//author
for $last in distinct-values($a/last),
$first in distinct-values($a[last=$last]/first)
return
<result>{$last}{$first}</result>
}
</results>
|
|
|
|
|
I'm trying to write an XPath query to match a node that has an attribute that contains a certain word. The obvious *[@attr="findme"] only works if the target attribute consists of *only* the word "findme". My target XML nodes might have the attribute "foo findme bar".
Using *[contains(@attr,"findme")] doesn't quite work either since it will also match a node if the attribute contains "x-findme", for example.
The best I've been able to come up with is this:
*[contains(concat(" ",concat(@class," ")," findme ")]
but this is obviously clumsy.
Is there a better way e.g. some way I can define my own XPath extension function called contains_word() that I can get MXSML to invoke?
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
|
That is XPath 2.0 and I am not aware of any support for it yet, is there?
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Ya, you're right. Unfortunately Microsoft sucks and doesn't support it. Of course apache and altova can read XPath 2. There aren't any cool extension functions that can stand in place of that either. I guess another thing that can be done is to sneak some script into the style sheet (if you're using a style sheet).
<msxsl:script language="JavaScript" implements-prefix="my-prefix">
<![CDATA[
function SomeFunction(text) { ... }
]]>
</msxsl:script>
...
<xsl:if test="my-prefix:SomeFunction('some text')">...
Logifusion[^]
|
|
|
|
|
And I just fired up my IDE to give it a go. Sigh...
Thanks for the suggestion anyway.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Hello everyone,
I have a quick question with regards to .NET web services and WSE 3.0. If this is the wrong forum for this, I apologize. If you could direct me as to where to leave this on Code Project I’d appreciate it.
The short of it. I'd like to create a web service that will strictly communicate with a custom client. No other client should be able to gain access to the web service.
More details: The web service should not be able to talk to any other client or browsers out in the great unknown of the internet. However, the web service will be internet facing as the client will communicate with the web service over the internet. The client will be run from PCs which are not part of the same domain as the web service. In fact, the client-running machines will be freshly re-imaged (ghosted) computers.
Would anyone be able to make additional suggestions in regards to a solution? I’ve been researching this for sometime now. Some previous suggestions have included:
X.509 Certificate
Windows Certificate Authority service
Custom Binary Authentication (a custom PKI implementation, not using X.509)
Username / Password.
Custom (Calculated) hash value sent with message. “Computer Authorization Code”
Thank You Everyone,
Frank V.
JawzX02@yahoo.com
|
|
|
|
|
Jawz-X wrote: Some previous suggestions have included:
When it comes to security I would not consider any "custom" solutions.
http://en.wikipedia.org/wiki/WS-Security[^]
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I would normally agree. However, at this time I'm tying to collect all possible solutions (my manager wants to see them, I suppose to consider all costs involved)
Anyway, I appreciate your post however that doesn't answer my question....
Thanks though!
Frank V.
JawzX2003@yahoo.com
|
|
|
|
|
Jawz-X wrote: Anyway, I appreciate your post however that doesn't answer my question....
depends on your definition of "additional suggestions" I considered it "additional" to recommend eliminating consideration of non-standard solutions suggested by other people.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Anyone know how to format a dictation rules XML file for the the Microsoft Speech 5.1 SDK? I've seen several example of command rules, but haven't found a single dictation example yet. All the sample source code I've found so far says: LoadDictation(NULL, ...)
TIA
>>>-----> MikeO
|
|
|
|
|
Sorry for bumb nood question.
I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well?
All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff.
Please help!
|
|
|
|
|
inner wrote: XmlReader
string sxml = "<test>testing this</test>";
System.IO.StringReader reader = new StringReader(sxml);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(XmlReader.Create(reader));
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I face the same problem...
The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable...
Any idea???
|
|
|
|
|
Continuing from the previous example:
string strXml = ...;
string strXsl = ...;
XslCompiledTransform trans = new XslCompiledTransform();
trans.Load(XmlReader.Create(new StringReader(strXsl)));
StringBuilder sb = new StringBuilder();
trans.Transform(XmlReader.Create(new StringReader(strXml)), XmlWriter.Create(sb));
string outXml = sb.ToString();
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi All,
Here Is my XSL file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="2cm"/>
<fo:region-after extent="1.5cm"/>
<fo:region-before extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates select="Title"/>
<xsl:apply-templates select="TableEntries"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Title">
<fo:block font-size="18pt"
font-family="sans-serif"
line-height="20pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="Heading"/>
</fo:block>
<fo:block font-size="16pt"
font-family="sans-serif"
line-height="18pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="DateCreated"/>
</fo:block>
</xsl:template>
<xsl:template match="TableEntries">
<fo:block width="510pt">
<fo:table table-layout="fixed" width="510pt">
<xsl:if test="ClientName">
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
</xsl:if>
<fo:table-body>
<fo:table-row>
<xsl:for-each select="TableInfo">
<xsl:if test="ClientName">
<fo:table-cell>
<fo:block>
Client Name
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="ClientName"/>
</fo:block>
</fo:table-cell>
</xsl:if>
</xsl:for-each>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Here is my Xml File:
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='ClientLookUpResult.xsl'?>
<ClientLookUp>
<Title>
<Heading>Client Look-Up Result</Heading>
<DateCreated>Date Created: 06 July 2006 06:07PM</DateCreated>
</Title>
<TableEntries>
<TableInfo key="0">
<ClientName>Jan</ClientName>
</TableInfo>
<TableInfo key="1">
<ClientName>Koos</ClientName>
</TableInfo>
<TableInfo key="2">
<ClientName>Piet</ClientName>
</TableInfo>
<TableInfo key="3">
<ClientName>Gert</ClientName>
</TableInfo>
<TableInfo key="4">
<ClientName>San</ClientName>
</TableInfo>
</TableEntries>
</ClientLookUp>
When i run fop, it doesn't display anything...
Plz help.
He who laughs last...
|
|
|
|
|
Can you post what the XML:FO looks like after running the XML through this stylesheet. Offhand, it looks to me like these lines will never match anything:
<xsl:if test="ClientName">
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
</xsl:if>
Logifusion[^]
|
|
|
|