|
Thank you for your help. I couldn't figure out how to get my value into the attribute for the anchor and I couldn't even formulate the question correctly! I appreciate your help.
Irene
|
|
|
|
|
I would like to develop a web service to be invoked from an InfoPath form which will create a Blog posting in Sharepoint (V3). Blog would already exist, need to create post values from Infopath XML form values. I noticed there is a long list of Sharepoint objects that start with SP*. Would appreciate any help to get started. Thanks.
|
|
|
|
|
Hello,
I am transforming a XML file into another XML file using a XSLT.
Everything is working fine! I have only one problem:
I want one of the values in my XSLT file to be taken from a Key in my Web.Config AppSettings!
Please see the XSLT code:
Hi,
I was reading some Merge Methods in the web but I am having some problems making this work.
Look at my XSLT code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:dk="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="dk:*"/>
<xsl:template match="@*|text()|comment()"/>
<xsl:template match="/">
<xsl:element name="urlset">
<xsl:apply-templates select="//dk:siteMapNode[@google='true']"/>
</xsl:element>
</xsl:template>
<xsl:template match="dk:siteMapNode">
<xsl:element name="url">
<xsl:element name="loc">
<xsl:text>http://www.MYDOMAIN.com/</xsl:text>
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>
<xsl:element name="lastmod">
<xsl:value-of select="@lastmod"/>
</xsl:element>
<xsl:element name="changefreq">
<xsl:value-of select="@changefreq"/>
</xsl:element>
<xsl:element name="priority">
<xsl:value-of select="@priority"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Do you see the line?
<xsl:text>http://www.MYDOMAIN.com/</xsl:text>
I want "http://www.MYDOMAIN.com/" to be taken from a Key in Application Settings in my Web.Config or at run time before the XML file is displayed.
Thanks,
Miguel
|
|
|
|
|
You can pass a parameter into the XSL when you perform the transformation. The XSL would have this:
<xsl:stylesheet version="1.0" ... >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="myUrl"/>
...
<xsl:element name="loc">
<xsl:value-of select="$myUrl" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>
...
Then when you perform the transformation, we'll assume you have a XslCompiledTransform object called transform . You just create an XsltArgumentList object and pass it in when you call Transform :
XsltArgumentList xal = new XsltArgumentList();
xal.AddParam("myUrl", "", "http://www.MYDOMAIN.COM");
transform.Transform("some.xml", xal, XmlWriter.Create("someoutput.xml"));
That way you should be able to pull your value from the app.config when you do the transformation.
|
|
|
|
|
hi, i have an xml and xsl for creating wordml. during the transformation i have to reach the some xsl nodes with xpath. but the xpaths i wrote always run for xml. how can i reach xsl inside the xsl? (there is only one xsl.)
Savas
|
|
|
|
|
If you are trying get the XSLT processor to address nodes in the XSLT file using XPath... you can't.
led mike
|
|
|
|
|
without xpath? or can i reach anyway?
Savas
|
|
|
|
|
savasorama wrote: or can i reach anyway?
"reach"? What does that mean?
led mike
|
|
|
|
|
Are you storing XML data in your XSL stylesheet or are you trying to run a set of XSL commands from a different place in the stylesheet?
|
|
|
|
|
I'm storing data in the xml file and transforming to the wordml via xsl. My problem is; there is font name and size declaration in the xsl and also one template that replaces string. In the xsl all <w:rPr> tags have <w:rFonts w:ascii="Arial"> but when the replace string template being called all of these fonts are ignored and it writes with the default font (Times New Roman).
Is there any way to let this not happen?
|
|
|
|
|
I'd have to see a little of your XSL to help with this. Could you provide an example of where you have the font set up and then call the "replace string" template?
|
|
|
|
|
<w:tc>
<w:tcPr>
<w:tcW w:w="1476" w:type="dxa"/>
</w:tcPr>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial"/>
<wx:font wx:val="Arial"/>
<w:sz w:val="18"/>
<w:sz-cs w:val="18"/>
</w:rPr>
</w:pPr>
<xsl:variable name="value">
<xsl:call-template name="replace-string">
<xsl:with-param name="text">
<xsl:call-template name="replace-string">
<xsl:with-param name="text">
<xsl:call-template name="replace-string">
<xsl:with-param name="text">
<xsl:value-of select="obj:ClientName"/>
</xsl:with-param>
<xsl:with-param name="replace">[H]</xsl:with-param>
<xsl:with-param name="with"><b><i></xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="replace">[/H]</xsl:with-param>
<xsl:with-param name="with"></i></b></xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="replace">&</xsl:with-param>
<xsl:with-param name="with">&amp;</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="msxsl:node-set(elu:StringToDom($value,'true'))/*" mode="dynamic-formatting"/>
</w:p>
</w:tc>
this is the font-name declaration and template calling part..
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$with"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="with" select="$with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
and this is the template.. Thanks...
Savas
|
|
|
|
|
I think your XSL is fine. It's probably got something to do with how you're organizing the WordML tags. For instance, when I see the node <w:rPr> in a WordML, it's usually inside a <w:r> instead of a <w:pPr>. I would just be checking that the WordML is correct because your XSL looks fine and shouldn't be the cause of the changing fonts.
|
|
|
|
|
Hi everybody,
I reading an XML file with the code bellow and when I want to get the value of an xml node there are also whitespaces (space, newline, tab) and the Ignore Whitespace are set to true.
Any ideea is welcome.
Dim xmlsettings As New XmlReaderSettings
With xmlsettings
.ConformanceLevel = ConformanceLevel.Auto
.IgnoreComments = True
.IgnoreProcessingInstructions = True
.IgnoreWhitespace = True
End With
Dim reader As XmlReader = XmlReader.Create(file, xmlsettings)
Dim doc As New XmlDocument
doc.Load(reader)
Dim root As XmlElement = doc.DocumentElement
Dim invoiceId As XmlNode = root.SelectSingleNode("/a/b")
biglewy
|
|
|
|
|
They hide that information in the documentation[^]
Gets or sets a value indicating whether to ignore insignificant white space.
White space that is not considered to be significant includes spaces, tabs, and blank lines
used to set apart the markup for greater readability.
led mike
|
|
|
|
|
If the spaces inside a tag are significant, it's best to enclose them in a CDATA block so they will always be preserved, for example:
<foo><![CDATA[this is
lots of
stuff...
x>]]
</foo>
|
|
|
|
|
Thanks because you reply to this question.
I think I wasn't very clear.
So, my problem is that I have an xml node like below and I want to read this node without whitespace,in my code I create an XmlReaderSettings.IgnoreWhitespace=true,
but my problem is that when I read the node I got also the whitespaces(newline,tabs) that I don't want, even if is set the xmlsettings.ignorewhitespace=true.
I read the file wiht xmlreader and after then for further processing this reader it's given to an xmldocument like this:
Dim xmlsettings As New XmlReaderSettings
With xmlsettings
.IgnoreWhitespace = True
.IgnoreComments = True
.ProhibitDtd = False
End With
Dim reader As XmlReader = XmlReader.Create(file, xmlsettings)
Dim doc As New XmlDocument
doc.PreserveWhitespace = False
doc.Load(reader)
reader.Close()
Dim root As XmlElement = doc.DocumentElement
Dim invoiceId As XmlNode = _ root.SelectSingleNode("/invoice_collection/customer_info/customer_code")
Dim customer_code = invoiceId.InnerText
<invoice_collection>
<customer_info>
<customer_code>
0006034318
</customer_code>
</customer_info>
</invoice_collection>
biglewy
|
|
|
|
|
biglewy wrote: I got also the whitespaces(newline,tabs) that I don't want, even if is set the xmlsettings.ignorewhitespace=true.
yes because as my post and the MSDN documentation explains that property is ONLY FOR WHITESPACE IN THE MARKUP .
led mike wrote: White space that is not considered to be significant includes spaces, tabs, and blank lines
used to set apart the markup for greater readability.
led mike
|
|
|
|
|
Just change your code to trim off the leading and trailing spaces:
Dim customer_code = invoiceId.InnerText.Trim()
|
|
|
|
|
I want to define a schema for an XML fiel that contains either a "Topic" or a "TopicList" which is a collection of topics.
i.e. the XML file should contain either
<?xml blubber?>
<Topic>
<!-- Topic blubber -->
</Topic>
or
<?xml blubber?>
<TopicList>
<Topic>
<!-- Topic blubber for topic 1 -->
</Topic>
<Topic>
<!-- Topic blubber for topic 2 -->
</Topic>
</TopicList>
I currently make the topic list required, but I'm curious how to avoid that.
|
|
|
|
|
peterchen wrote: but I'm curious how to avoid that.
Why would you want to? It seems your current solution is correct.
led mike
|
|
|
|
|
It's more a general question: can I check against different "top level tags" with one Schema?
All use cases I can imagine a mandatory "outer tag" solves things. But I'm doing my first "serious toying" with XML, I still don't like all these tags*, I come from a "be strict with your output, but flexible on your input" culture, and I just want to KNOW
a client once wanted 500 point curves exported as <point><X>12.34</X><Y>123.42</Y></point> in a time critical high throughput application - bno problem making them happy, but I'm still a big XML sceptic.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|
|
It's much easier to always have the outer container tag, no matter how many tags are inside it. That way, you can enumerate all the Topics with a simple /TopicList/Topic XPath query. Don't take shortcuts on your schema just to save yourself 5 seconds of typing.
|
|
|
|
|
This is easy to do in the Schema, the software that uses it is where the complication comes in with this type of structure. Never understood why someone would want to do this, but it can be done.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Topic">
</xs:complexType>
<xs:complexType name="TopicList">
<xs:sequence>
<xs:element type="Topic" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RootNode">
<xs:choice>
<xs:element type="Topic"></xs:element>
<xs:element type="TopicList"></xs:element>
</xs:choice>
</xs:complexType>
<xs:element type="RootNode"></xs:element>
</xs:schema>
Your root node is of type "RootNode", which is a Choice , meaning it will accept either a "Topic" or a "TopicList". And "TopicList" is a sequence of "Topics".
|
|
|
|
|
thanks a lot for the reply!
BoneSoft wrote: the complication comes in with this type of structure. Never understood why someone would want to do this, but it can be done.
OK OK, I get the hints
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|