|
Ok, sorry, i'll post documentation in future =)
OOXML documentation, part 4 says that the run defines a region of text with a common set of properties, represented by the r element. An r element allows the producer to specify a single set of formatting properties, applying the same information to all the contents of the run.
As I understood, it means, that some region of the text (from the same paragraph) whith the common set of properties can be placed in one run, am i not correct?
The question is why there so many runs with the same properties in one paragraph? In most documents I viewed, there where lots of runs within the paragraph and all of them had the same properties.
In my case, even word was divided.
I came to the conclusion, that after some change of properties (and then back to the original), text can be divided in different runs, but how should i handle this?
What is really confuses me, is xml:space="preserve" element, OOXML specification refers to
http://www.w3.org/XML/1998/namespace, which says
The value "default" signals that applications' default white-space processing modes are acceptable for this element;
the value "preserve" indicates the intent that applications preserve all the white space.
This declared intent is considered to apply to all elements within the content of the element where it is specified,
unless overridden with another instance of the xml:space attribute.
But I really couldn't find any logic of how it works in OOXML..
|
|
|
|
|
The problem was solved.
All, what was said about xml:space="preserve" above is correct.
The problem was in my viewer, which incorret displaid documents.
|
|
|
|
|
Member 4083157 wrote: The problem was in my viewer, which incorret displaid documents.
I am glad you resolved the issue, and thanks for posting back your findings. Which viewer were you using?
led mike
|
|
|
|
|
Hi all
In my projecr we need to handle the singleclick and doubleclick events ;
when i use single click one action should perform
when i use doubleclick another action should perform
pleae help me
#sanroop#
|
|
|
|
|
And how do you do propose doing it in XML? Wrong question, wrong forum. Which is why you have had no answers.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I am using an XSL file to format a document for display on my website. A content block has a title, and contains HTML content. The references section always appears at the bottom of the rendered document (regardless of its location within the XML file).
<?xml version="1.0"?>
<mydoc>
<content title="Introduction">
...
</content>
<references>
...
</references>
</mydoc>
In the XSL I want to create a contents for the document. I have managed to get the content sections listed in the contents. But I find myself duplicating a large chunk of XSL just to add the references section to the contents.
Is there a way to do something along the lines of the following?
<xsl:variable name="contents-listing">
concatenate
?? Get list of content nodes "/mydoc/content" ??
with
<content title="References">
<references>
...
</references>
</content>
</xsl:variable>
so that I can:
<xsl:for-each select="$contents_listing">
<!-- Clicking an item goes to the corresponding named anchor -->
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#ref', position())" />
</xsl:attribute>
<xsl:value-of select="@title" />
</a>
</xsl:for-each>
and also:
<xsl:for-each select="$contents-listing">
<!-- Named anchor indicates where to click goes to -->
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat('ref', position())" />
</xsl:attribute>
<xsl:apply-templates />
</a>
</xsl:for-each>
Many thanks,
Lea Hayes
|
|
|
|
|
It's probably easy in XSLT 2, but if you're using XSLT 1 like most of us who are relying on Microsoft tools, avoiding duplicated xsl code ist hard.
Using a workaround pattern I've sometimes applied in such cases it would look like this:
<mydoc>
<content title="Introduction">
<xsl:call-template name="EvaluateContent">
<xsl:with-param name="Context">Contents</xsl:with-param>
</xsl:call-template>
</content>
<references>
<xsl:call-template name="EvaluateContent">
<xsl:with-param name="Context">References</xsl:with-param>
</xsl:call-template>
</references>
</mydoc>
<xsl:template name="EvaluateContent">
<xsl:param name="Context" />
<xsl:for-each select="/mydoc/content">
<xsl:choose>
<xsl:when test="$Context = 'Contents'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#ref', position())" />
</xsl:attribute>
<xsl:value-of select="@title" />
</a>
</xsl:when>
<xsl:when test="$Context = 'References'">
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat('ref', position())" />
</xsl:attribute>
</a>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
This is not nice, and can be further refined, but the only way I know to avoid duplicating the logic contained in the for-each statement.
I don't have the patience right now to adjust the tabs and spaces which don't look right in the preview.
And please be aware that I just copied and pasted it from some old stylesheets of mine and your fragments and have not tested it. There may be syntax errors, but I'm sure you get the gist.
And if any one points out a better pattern, I'll add my thanks to yours.
|
|
|
|
|
Hi,
Thanks for your advice! This has helped me to solve the problem!
Best regards,
Lea Hayes
|
|
|
|
|
Hi,
I'm trying to validate an Xml document using an XmlReader. Here is my code:
private void Validate(TextReader source, string xsd)
{
XmlReaderSettings settings = new XmlReaderSettings();
XmlUrlResolver resolver = new XmlUrlResolver();
settings.ProhibitDtd = false;
resolver.Credentials = CredentialCache.DefaultCredentials;
settings.XmlResolver = resolver;
settings.ValidationFlags = XmlSchemaValidationFlags.ProcessSchemaLocation;
settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
settings.Schemas.XmlResolver = resolver;
settings.Schemas.Add(null, xsd);
settings.Schemas.Compile();
\\settings.Schemas.Add(null, http://www.w3.org/2001/xml.xsd);
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += ValidationHandler;
XmlReader reader = XmlReader.Create(source, settings);
while (reader.Read())
{
}
}
The xsd of the xml document I want to validate contains an xs:import that points to local xsd (the schemaLocation is, as example "./dc.xsd"). This xsd imports serveral other xsd, one of which is the following:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd">
</xs:import>
When settings.Schemas.Add(null,xsd) is executed, all nested LOCAL xsd are correctly resolved by the XmlUrlResolver I created. If i inspect during debug my XmlReaderSetting instance i can see tha all the required xsd are correctly loaded, EXCEPT http://www.w3.org/2001/03/xml.xsd. Then settings.Schemas.Compile() is executed, an exception is raised telling me that the attribute xml:lang is not defined (it's defined in the missing xsd).
This exception is not raised, and validaion is performed correctly, if i manually add the namespace (see the commented line of my code), or if i change the scema location in the xsd file to point to a local copy of xml.xsd (schemaLocation="./xml.xsd").
I would like to know how can I make this work, because i don't want to add manually anything related to this specific scenario (i.e. i would like to reuse the code). In other words, why this remote location is not resolved?
|
|
|
|
|
Hi guys,
Usually I use XSL to transform XML at the server-side with ASP.NET. I have recently found out that it is possible to specify a stylesheet at the top of an XML file. The web browser then uses the XSL document to render the XML file.
I came across several websites which say that there is lack of browser support, but they were quite old.
I have tested a simple scenario in IE7, IE8 BETA, Chrome, FF3, and Safari and it seems to work wonders. So I didn't know whether there were any more subtle issues, or compatibility problems.
Are there any issues with this approach? Ideally I wanted to have the client browser do the transforms to ease the load at the server-side.
Many thanks,
Lea Hayes
|
|
|
|
|
lhayes00 wrote: So I didn't know whether there were any more subtle issues, or compatibility problems.
There certainly can be, I imagine. This is awkward since I detest assumptions, however given the history of browser compatibility it's likely a safe one.
lhayes00 wrote: Are there any issues with this approach?
Obviously, the more basic your XML-XSLT is the less likely any problems will surface. Conversely.... well I think you get the idea, yes?
led mike
|
|
|
|
|
I'm not sure which browsers other than IE support embedded XSLT documents, meaning they automatically do the transformation. However you can do the transformation using javascript and write out the result using the .innerHTML property. This is especially useful when creating Ajax style interfaces.
The code looks something like this:
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.async = false;
xmlDoc.load("doc.xml")
var xslDoc = new ActiveXObject("Msxml2.DOMDocument");
xslDoc.async = false;
xslDoc.load(Server.MapPath("doc.xsl"));
myDiv.innerHTML = xmlDoc.transformNode(xslDoc);
For cross-browser support you will need to modify the line of code where you create the Xml document because different browsers handle it differently.
|
|
|
|
|
Hi,
That's fantastic! I am working on Ajax stuff at the moment, I didn't realize you could do XSL transforms with JavaScript.
Thanks for that!
Lea Hayes
|
|
|
|
|
Hai,
I just want to know "joomla" can you give me the related search.
With regards,
rose
|
|
|
|
|
rose196 wrote: can you give me the related search.
You mean this?[^]
led mike
|
|
|
|
|
Hai led mike
Thanks for your reply. Yes, I mean that only. Already I saw the link but I couldn't understand.Can you give the exact link related to 'joomla' Or can you tell me the use of 'joomla'.
Thanks and Regards,
Rose
|
|
|
|
|
rose196 wrote: I saw the link but I couldn't understand.
It's difficult to believe you can't understand a Google search. On the other hand, if you truly can't then it is likely a waste of time trying to help you.
|
|
|
|
|
Loading an XML file into C# I get the error: "There is an error in XML document (5, 4)." but nothing looks wrong and it loads without error into MS's XML Notepad. Any suggestions?
|
|
|
|
|
My first guess is there is something wrong with the file or XML you are loading. Are you sure you know what you are loading?
led mike
|
|
|
|
|
Sorted it - it was saved in Germany and the numbers in it were in "0,000" format instead of "0.000" and unsurprisingly it barfed.
|
|
|
|
|
when i run xsd.exe with my xml file it reports that it can't create nested tables in multiple namesapces, is there a way around this? the xml example below does not generate this error, the example xml is to show part of the structure of the xml doc
I need to be able to read when i leave the Computer and user elements of the xml doc below, what is the best way to read this xml file?
<gpo>
<computer>
<versiondirectory>0</versiondirectory>
<versionsysvol>0</versionsysvol>
<enabled>true</enabled>
</computer>
- <user>
<versiondirectory>2</versiondirectory>
<versionsysvol>2</versionsysvol>
<enabled>true</enabled>
- <extensiondata>
- <extension xmlns:q1="http://www.microsoft.com/GroupPolicy/Settings/Registry" xsi:type="q1:RegistrySettings" xmlns:xsi="#unknown">
- <q1:policy>
<q1:name> Data</q1:name>
</q1:policy>
</extension>
<name>Registry</name>
</extensiondata>
</user>
</gpo>
|
|
|
|
|
I need to scan a very big XML file (several millions of records), and I have discovered that access to data is very slow.
On a Pentium IV / 3 Ghz, the following instruction need 9 milliseconds :
BSTR BSTR_Result;
IXMLDOMNodePtr pNode;
// scan tree of nodes
...
pNode = pNode->nextSibling; // very quick (0 ms)
// get the text of the node
pNode->get_text( &BSTR_Result); // < need 9 milliseconds
To scan the whole file, the call to "nextSibling" is very quick. But the access to value is very slow ("get_text").
How can I increase performances ?
Best regards.
|
|
|
|
|
marcelcerdanjunior wrote: How can I increase performances ?
marcelcerdanjunior wrote: How can I increase performances ?
You can try switching to a SAX parser but I doubt that will satisfy your 9ms requirement. It is far more likely that you are abusing XML. XML is NOT a replacement for Databases. You will probably have to use some form of optimized database to satisfy your 9ms requirement.
Last modified: after originally posted -- clicked wrong button
led mike
|
|
|
|
|
It is strange that DOT.NET gives correct performances (less than 1 second to find a record in million list), but not the msxml4.dll interface.
|
|
|
|
|
marcelcerdanjunior wrote: It is strange that DOT.NET gives correct performances (less than 1 second to find a record in million list), but not the msxml4.dll interface.
Why is that strange? It would be strange if they were the same thing, but since they are not the same thing why is it strange. There is a web page out there somewhere that lists the multitude of XML parsers with performance information. But again, at a million records that just screams "Database".
led mike
|
|
|
|