By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

problem with xsl for multivalue strings

P: n/a
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>HTTP/1.1 200 OK</a:status>
<a:prop>
<d:customerid>1049306</d:customerid>
<e:professioncode b:dt="mv.string">
<c:v>byggtapetserarbeider</c:v>
<c:v>malerarbeider</c:v>
</e:professioncode>
</a:prop>
</a:propstat>
</a:response>

I want to display this tab-separated and have this xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
xmlns:a="DAV:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:for-each select="a:propstat/a:prop/f:professioncode/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:

byggtapetserarbeidermalerarbeider,

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 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Hi,

Tempore 17:38:45, die Thursday 28 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: 'c'.

Where am I going wrong?

The error message sais it all: you're trying to access an element "c:v" but you didn't declare the namespace that goes with "c". Just add the correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of" element.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 28 '05 #2

P: n/a
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...
Hi,

Tempore 17:38:45, die Thursday 28 July 2005 AD, hinc in foro
{comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
With the "for-each" I get this error:
msxml4.dll: Reference to undeclared namespace prefix: 'c'.

Where am I going wrong?

The error message sais it all: you're trying to access an element "c:v"
but you didn't declare the namespace that goes with "c". Just add the
correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of"
element.


I thought so too, so I tried

xmlns:c="c:"

and

<xsl:for-each select="a:propstat/a:prop/f:professioncode/c:v">
<xsl:value-of select="concat(., ',')"/>
</xsl:for-each>

Is this right?

With this code I get even less than before (no professioncodes at all), but
no error.

--
_________________
Rolf @ Questus ans
Jul 28 '05 #3

P: n/a
Tempore 20:54:06, die Thursday 28 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
The error message sais it all: you're trying to access an element "c:v"
but you didn't declare the namespace that goes with "c". Just add the
correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of"
element.


I thought so too, so I tried

xmlns:c="c:"


Obviously, the namespace-uri (between the quotes) has to be the same as the one declared in the source XML; it is not dummy data. "c:" is a very unlikely uri...
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 28 '05 #4

P: n/a
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...
Tempore 20:54:06, die Thursday 28 July 2005 AD, hinc in foro
{comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
The error message sais it all: you're trying to access an element "c:v"
but you didn't declare the namespace that goes with "c". Just add the
correct "xmlns:c" attribute to an ancestor-or-self of the "xsl:value-of"
element.


I thought so too, so I tried

xmlns:c="c:"


Obviously, the namespace-uri (between the quotes) has to be the same as
the one declared in the source XML; it is not dummy data. "c:" is a very
unlikely uri...


Well I've tried what looks like the correct namespace-uri:

xmlns:c="cln-ewa:standard:professioncode:"

and then:

<xsl:for-each select="a:propstat/a:prop/c:v">
<xsl:value-of select="concat(., ',')"/>
</xsl:for-each>

But nothing comes out of it (no professioncode). You can see the structure
in my xml in the OP.

--
_________________
Rolf @ Questus ans
Jul 29 '05 #5

P: n/a
Tempore 08:54:27, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
xmlns:c="cln-ewa:standard:professioncode:"

and then:

<xsl:for-each select="a:propstat/a:prop/c:v">
<xsl:value-of select="concat(., ',')"/>
</xsl:for-each>

But nothing comes out of it (no professioncode).

That's pretty logical: there's no location step for 'professioncode'

INPUT XML:
<a:multistatus
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:">
<a:response>
<a:href>http://server/public/sol/comp/1049306.eml</a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<d:customerid>1049306</d:customerid>
<e:professioncode b:dt="mv.string">
<c:v>byggtapetserarbeider</c:v>
<c:v>malerarbeider</c:v>
</e:professioncode>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:for-each select="a:propstat/a:prop/e:professioncode/c:v">
<xsl:value-of select="concat(., ',')" />
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

OUTPUT :
1049306 byggtapetserarbeider,malerarbeider,
I only just thought about this: Do you need all data of type 'multivalue strings' to be seperated by comma's? If so, it's better to use a template:

<xsl:stylesheet version="1.0"
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template

match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:propstat/a:prop/e:professioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>

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

</xsl:stylesheet>

That will give you following output:
1049306 byggtapetserarbeider,malerarbeider


regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 29 '05 #6

P: n/a
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...
Tempore 08:54:27, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml}
scripsit Rolf Barbakken <no******@alexandria.cc>:
xmlns:c="cln-ewa:standard:professioncode:"

and then:

<xsl:for-each select="a:propstat/a:prop/c:v">
<xsl:value-of select="concat(., ',')"/>
</xsl:for-each>

But nothing comes out of it (no professioncode). That's pretty logical: there's no location step for 'professioncode'

INPUT XML:
<a:multistatus
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:">
<a:response>
<a:href>http://server/public/sol/comp/1049306.eml</a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<d:customerid>1049306</d:customerid>
<e:professioncode b:dt="mv.string">
<c:v>byggtapetserarbeider</c:v>
<c:v>malerarbeider</c:v>
</e:professioncode>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:for-each select="a:propstat/a:prop/e:professioncode/c:v">
<xsl:value-of select="concat(., ',')" />
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

OUTPUT :
1049306 byggtapetserarbeider,malerarbeider,


I get no professioncode with this code.
I only just thought about this: Do you need all data of type 'multivalue
strings' to be seperated by comma's? If so, it's better to use a template:

<xsl:stylesheet version="1.0"
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template

match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:propstat/a:prop/e:professioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>

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

</xsl:stylesheet>

That will give you following output:
1049306 byggtapetserarbeider,malerarbeider


This returns absolutely nothing. Not one single byte of data. But no error.

The entire xsl now looks like this:
<xsl:stylesheet version="1.0"
xmlns:a="DAV:"
xmlns:b="unknown"
xmlns:c="cln-ewa:standard:professioncode:"
xmlns:d="urn:schemas:contacts:"
xmlns:e="cln-ewa:custom:"
xmlns:f="cln-ewa:standard:"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:sn"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(a:propstat/a:prop/d:street,
' ', ' ')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(a:propstat/a:prop/d:postalcode,
' ', '')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:l"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:officetelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:telephoneNumber"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:mobile"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:email1"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:customerid"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:contacturl"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:facsimiletelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/a:creationdate"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:department"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:deleted"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:maker"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:work"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:ssn"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:visitadr"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:businesshomepage"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:agressoid"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:agressoinitials"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/d:homeState"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:contactikon"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:customergroup"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:contactperson"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:projects"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:agressonew"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:extagressoid"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/e:foretn"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:mycontact"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:activeprojects"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/f:contacted"/>
<xsl:text> </xsl:text>
<xsl:value-of select="a:propstat/a:prop/a:contentclass"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:propstat/a:prop/e:professioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template match="*[@b:dt='mv.string']/*[position() !=last()]">
<xsl:value-of select="." /><xsl:text>,</xsl:text>
</xsl:template>
</xsl:stylesheet>

I really appreciate the help.

--
_________________
Rolf @ Questus ans
Jul 29 '05 #7

P: n/a
Tempore 18:44:06, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:
This returns absolutely nothing. Not one single byte of data. But no error.

I bet it's still a namespace issue.
Anyway, this conversation is leading nowhere. The XML sample in the OP was incomplete, I had to make to much assumptions.
Please provide the full XML (maybe a link to it?).

BTW, You don't need to copy everything I write litteraly;)
e.g. if I write xmlns:b="unknown" that means I do not posses enough information to make write the proper namespace-uri. You should have corrected it.

I hope we can soon fix this...
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 29 '05 #8

P: n/a
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...
Tempore 18:44:06, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml}
scripsit Rolf Barbakken <no******@alexandria.cc>:
This returns absolutely nothing. Not one single byte of data. But no
error.

I bet it's still a namespace issue.
Anyway, this conversation is leading nowhere. The XML sample in the OP was
incomplete, I had to make to much assumptions.
Please provide the full XML (maybe a link to it?).


I have sent you an email. Hope the address is correct.

--
_________________
Rolf @ Questus ans
Jul 29 '05 #9

P: n/a
Tempore 22:04:55, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml} scripsit Rolf Barbakken <no******@alexandria.cc>:

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

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:f="cln-ewa:custom:"
xmlns:c="xml:"
xmlns:g="urn:schemas-microsoft-com:office:office"
xmlns:e="cln-ewa:standard:"
xmlns:d="urn:schemas:contacts:"
xmlns:a="DAV:">
<xsl:output method="text"/>
<xsl:template
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:for-each select="(a:propstat/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:street"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:postalcode"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:l"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:officetelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:telephoneNumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:mobile"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:email1"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:customerid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contacturl"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:facsimiletelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:creationdate"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:department"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:deleted"/>
<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:visitadr"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:businesshomepage"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressoid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressoinitials"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:homeState"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contactikon"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:customergroup"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:contactperson"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:projects"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressonew"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:extagressoid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:foretn"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:mycontact"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:activeprojects"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contacted"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:contentclass"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:professioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>

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

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

<xsl:template match="d:postalcode">
<xsl:value-of select="translate(., ' ', '')" />
</xsl:template>

</xsl:stylesheet>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Jul 29 '05 #10

P: n/a
"Joris Gillis" <ro**@pandora.be> wrote in message
news:op***************@news.pandora.be...
Tempore 22:04:55, die Friday 29 July 2005 AD, hinc in foro {comp.text.xml}
scripsit Rolf Barbakken <no******@alexandria.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.transformNode(objXSLDOM)

the result is nothing.

The XSL:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:f="cln-ewa:custom:"
xmlns:c="xml:"
xmlns:g="urn:schemas-microsoft-com:office:office"
xmlns:e="cln-ewa:standard:"
xmlns:d="urn:schemas:contacts:"
xmlns:a="DAV:">
<xsl:output method="text"/>
<xsl:template
match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:for-each select="(a:propstat/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:street"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:postalcode"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:l"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:officetelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:telephoneNumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:mobile"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:email1"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:customerid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contacturl"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:facsimiletelephonenumber"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:creationdate"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:department"/>
<xsl:text> </xsl:text>
<xsl:text></xsl:text>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:deleted"/>
<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:visitadr"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:businesshomepage"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressoid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressoinitials"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="d:homeState"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contactikon"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:customergroup"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:contactperson"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:projects"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:agressonew"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:extagressoid"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:foretn"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:mycontact"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:activeprojects"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="f:contacted"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="a:contentclass"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="e:professioncode"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match="*[@b:dt='mv.string']/*[position() !=last()]">
<xsl:value-of select="." /><xsl:text>,</xsl:text>
</xsl:template>
<xsl:template match="d:street">
<xsl:value-of select="translate(., ' ', ' ')" />
</xsl:template>
<xsl:template match="d:postalcode">
<xsl:value-of select="translate(., ' ', '')" />
</xsl:template>
</xsl:stylesheet>
--
_________________
Rolf @ Questus ans
Jul 29 '05 #11

P: n/a
This one's nicer:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:f="cln-ewa:custom:"
xmlns:c="xml:"
xmlns:g="urn:schemas-microsoft-com:office:office"
xmlns:e="cln-ewa:standard:"
xmlns:d="urn:schemas:contacts:"
xmlns:a="DAV:">
<xsl:output method="text"/>

<xsl:variable name="field">
<xsl:text> d:sn d:street d:postalcode d:l d:officetelephonenumber d:telephoneNumber d:mobile d:email1 d:customerid f:contacturl d:facsimiletelephonenumber a:creationdate d:department f:deleted f:maker f:work f:ssn f:visitadr d:businesshomepage e:agressoid e:agressoinitials d:homeState f:contactikon f:customergroup e:contactperson f:projects e:agressonew e:extagressoid e:foretn f:mycontact f:activeprojects f:contacted a:contentclass e:professioncode</xsl:text>
</xsl:variable>

<xsl:template match="/">
<xsl:for-each select="a:multistatus/a:response">
<xsl:for-each select="(a:propstat/a:prop)[1]">
<xsl:call-template name="fieldCreator"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>

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

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

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

<xsl:template match="d:postalcode">
<xsl:value-of select="translate(., ' ', '')" />
</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 discussion thread is closed

Replies have been disabled for this discussion.