473,806 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with xsl for multivalue strings

I have an xml with records like this one:

<a:response>
<a:href>http://server/public/sol/comp/1049306.eml</a:href>
<a:propstat>
<a:status>HTT P/1.1 200 OK</a:status>
<a:prop>
<d:customerid>1 049306</d:customerid>
<e:professionco de b:dt="mv.string ">
<c:v>byggtapets erarbeider</c:v>
<c:v>malerarbei der</c:v>
</e:professioncod e>
</a:prop>
</a:propstat>
</a:response>

I want to display this tab-separated and have this xsl:
<?xml version="1.0"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
xmlns:a="DAV:"
xmlns:d="urn:sc hemas:contacts: "
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
match="/">
<xsl:for-each select="a:multi status/a:response">
<xsl:value-of select="a:props tat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:for-each select="a:props tat/a:prop/f:professioncod e/c:v">
<xsl:value-of select="concat( ., ',')" />
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I have no problem getting the customerid, but without a "for-each" the
professioncode always comes out as a single string with no separation like
this:

byggtapetserarb eidermalerarbei der,

With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: 'c'.

Where am I going wrong?

--
_______________ __
Rolf @ Questus ans
Jul 28 '05
11 1924
"Joris Gillis" <ro**@pandora.b e> wrote in message
news:op******** *******@news.pa ndora.be...
Tempore 22:04:55, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml}
scripsit Rolf Barbakken <no******@alexa ndria.cc>:

Here's the sylesheet, it does not look very neat, but at least it works.


How did you test it?

I get nothing out of this xsl-file. The XML fills up nicely, but when I do a

objXMLDOM.trans formNode(objXSL DOM)

the result is nothing.

The XSL:
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:b="urn:uu id:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:f="cln-ewa:custom:"
xmlns:c="xml:"
xmlns:g="urn:sc hemas-microsoft-com:office:offi ce"
xmlns:e="cln-ewa:standard:"
xmlns:d="urn:sc hemas:contacts: "
xmlns:a="DAV:">
<xsl:output method="text"/>
<xsl:template
match="/">
<xsl:for-each select="a:multi status/a:response">
<xsl:for-each select="(a:prop stat/a:prop)[1]">
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:sn"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:stree t"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:posta lcode"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:l"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:offic etelephonenumbe r"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:telep honeNumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:mobil e"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:email 1"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:custo merid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:conta cturl"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:facsi miletelephonenu mber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:creat iondate"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:depar tment"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:delet ed"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:maker "/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:work"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:ssn"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:visit adr"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:busin esshomepage"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agres soid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agres soinitials"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:homeS tate"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:conta ctikon"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:custo mergroup"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:conta ctperson"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:proje cts"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agres sonew"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:extag ressoid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:foret n"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:mycon tact"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:activ eprojects"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:conta cted"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:conte ntclass"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:profe ssioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match="*[@b:dt='mv.strin g']/*[position() !=last()]">
<xsl:value-of select="." /><xsl:text>,</xsl:text>
</xsl:template>
<xsl:template match="d:street ">
<xsl:value-of select="transla te(., ' ', ' ')" />
</xsl:template>
<xsl:template match="d:postal code">
<xsl:value-of select="transla te(., ' ', '')" />
</xsl:template>
</xsl:stylesheet>
--
_______________ __
Rolf @ Questus ans
Jul 29 '05 #11
This one's nicer:
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:b="urn:uu id:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:f="cln-ewa:custom:"
xmlns:c="xml:"
xmlns:g="urn:sc hemas-microsoft-com:office:offi ce"
xmlns:e="cln-ewa:standard:"
xmlns:d="urn:sc hemas:contacts: "
xmlns:a="DAV:">
<xsl:output method="text"/>

<xsl:variable name="field">
<xsl:text> d:sn d:street d:postalcode d:l d:officetelepho nenumber d:telephoneNumb er d:mobile d:email1 d:customerid f:contacturl d:facsimiletele phonenumber a:creationdate d:department f:deleted f:maker f:work f:ssn f:visitadr d:businesshomep age e:agressoid e:agressoinitia ls d:homeState f:contactikon f:customergroup e:contactperson f:projects e:agressonew e:extagressoid e:foretn f:mycontact f:activeproject s f:contacted a:contentclass e:professioncod e</xsl:text>
</xsl:variable>

<xsl:template match="/">
<xsl:for-each select="a:multi status/a:response">
<xsl:for-each select="(a:prop stat/a:prop)[1]">
<xsl:call-template name="fieldCrea tor"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>

<xsl:template name="fieldCrea tor">
<xsl:param name="fields" select="concat( $field,' ')"/>
<xsl:apply-templates select="*[name()=substrin g-before($fields, ' ')]"/>
<xsl:if test="substring-after($fields,' ')">
<xsl:text> </xsl:text>
<xsl:call-template name="fieldCrea tor">
<xsl:with-param name="fields" select="substri ng-after($fields,' ')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template match="*[@b:dt='mv.strin g']/*[position() !=last()]">
<xsl:value-of select="." /><xsl:text>,</xsl:text>
</xsl:template>

<xsl:template match="d:street ">
<xsl:value-of select="transla te(., ' ', ' ')" />
</xsl:template>

<xsl:template match="d:postal code">
<xsl:value-of select="transla te(., ' ', '')" />
</xsl:template>

</xsl:stylesheet>

P.S. Watch out for wrapping. The data of <xsl:variable name="field"/> should all be on 1 line.
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 29 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1672
by: Joel Barsotti | last post by:
In asp3, you could set a multivalue cookie by doing something like this Response.Cookies("login")("user") = Session('user'); Response.Cookies("login")("password") = Session('password'); Response.Cookies("login")("version") = Application('cookieVersion'); I can't seem to find a way to do anything similiar with the HttpCookie object, is there something that I'm missing or do I need to manage a cookie for each value I want to set these...
2
5523
by: Fredrik Rodin | last post by:
All, I'm having problems with my resource manager in ASP.NET 2.0 after conversion from ASP.NET 1.1. Here is a background: In ASP.NET 1.1 All my user controls and aspx pages inherit from base classes. A base class includes this property (among others...;-)):
16
4932
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
14
2544
by: Dennis Benzinger | last post by:
Hi! The following program in an UTF-8 encoded file: # -*- coding: UTF-8 -*- FIELDS = ("Fächer", ) FROZEN_FIELDS = frozenset(FIELDS) FIELDS_SET = set(FIELDS)
22
1923
by: sam_cit | last post by:
Hi Everyone, I have the following structure in my program struct sample { char *string; int string_len; };
11
2428
by: Bob Rock | last post by:
Hello, I have an array of strings and need to find the matching one with the fastest possible code. I decided to order the array and then write a binary search algo. What I came up with is the following. I noticed that if I set: int upper = strings.GetUpperBound(0); I never match the last element in the array (i.e. "iii")
0
1444
by: nass | last post by:
hello everyone and happy new year. i am not sure how to tackle this problem or where is originates from so i am writing here in hope that if you can not help you can at least point me in a direction. I am writing some little program using only standard c++ library and i am opening a file that contains strings. there are numbers , english and greek letters among the characters. the reading is done fine and the data are then stored onto a...
1
4129
by: Ben | last post by:
NooB: Anyone help with what I could be doing incorrectly here? Trying to have a parameter drop down list where a user can select one or more of the available values contained in the table to filter out results. Have a single table with five values. Keep getting the following error.... Table name is Name Field is NickName Parameter name is "Nick", datatype string, prompt "Select NickNames",
5
1759
by: varshaP | last post by:
Hi.. How to remove selected value from a readonly multivalue field, on clicking the button ?
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.