473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Stumped Transforming DSML Data With XSLT`

I'm using the BIE workflow engine and after querying an LDAP DSA I need
to transform the XML response, which looks like -

<?xml version="1.0" encoding="UTF-8" ?>
<batchResponse xmlns="urn:oasis:names:tc:DSML:2:0:core"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<searchResponse requestID="9">
<searchResultEntry dn="cn=Larry Simmons,ou=People,o=Morrison
Industries,c=US" requestID="9">
attr name="morrisonserialid">
<value>1015</value>
</attr>
<attr name="birthDate">
<value>02/17/1948</value>
</attr>
<attr name="cn">
<value>Larry Simmons</value>
</attr>
<attr name="employeeNumber">
<value>KZO004</value>
</attr>
</searchResultEntry>
.....
<searchResultDone requestID="9">
<resultCode code="0" descr="Success" />
</searchResultDone>
</searchResponse>
</batchResponse>

Into something like -
<result>
<row>
<cn>...</cn>
<birthdate>...</birthdate>
....
</row>
....
</result>

So I have an xslt like
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<result>
<xsl:for-each
select="batchResponse/searchResponse/searchResultEntry">
<xsl:sort select="morrisonserialid"/>
<row>
<cn><xsl:value-of select="attr[@name='cn']/value"/></cn>
<birthdate><xsl:value-of
select="attr[@name='birthday']/value"/></birthdate>
<morrisonserialid><xsl:value-of
select="attr[@name='morrisonserialid']/value"/></morrisonserialid>
<fileAs><xsl:value-of
select="attr[@name='fileAs']/value"/></fileAs>
<startDate><xsl:value-of
select="attr[@name='morrisonpositionstartdate']/value"/></startDate>
</row>
</xsl:for-each>
</result>
</xsl:template>
</xsl:stylesheet>

Only when I -
xsltproc /var/spool/bie/xslt/dsaEmployeeExport.2.xslt /tmp/ldapData.xml
- all I get is -
<?xml version="1.0"?>
<result/>

Huh?

Jul 20 '05 #1
2 2853
Tempore 20:02:40, die Tuesday 01 February 2005 AD, hinc in foro {comp.text.xml} scripsit <aw******@whitemice.org>:
Only when I -
xsltproc /var/spool/bie/xslt/dsaEmployeeExport.2.xslt /tmp/ldapData.xml
- all I get is -
<?xml version="1.0"?>
<result/>

Huh?

Hi,

It is a namespacing issue.
Include the namespace of the XML document in the XSLT
e.g.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="in" xmlns:in="urn:oasis:names:tc:DSML:2:0:core">

<xsl:template match="/">
<result>
<xsl:for-each
select="in:batchResponse/in:searchResponse/in:searchResultEntry">
<xsl:sort select="in:morrisonserialid"/>
<row>
<cn><xsl:value-of select="in:attr[@name='cn']/in:value"/></cn>
<birthdate><xsl:value-of
select="in:attr[@name='birthday']/in:value"/></birthdate>
<morrisonserialid><xsl:value-of
select="in:attr[@name='morrisonserialid']/in:value"/></morrisonserialid>
<fileAs><xsl:value-of
select="in:attr[@name='fileAs']/in:value"/></fileAs>
<startDate><xsl:value-of
select="in:attr[@name='morrisonpositionstartdate']/in:value"/></startDate>
</row>
</xsl:for-each>
</result>
</xsl:template>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Veni, vidi, wiki (http://www.wikipedia.org)
Jul 20 '05 #2

this is a FAQ,

<batchResponse xmlns="urn:oasis:names:tc:DSML:2:0:core"

an element with name consisting of local name batchResponse and
Namespace URI urn:....
<xsl:for-each
select="batchResponse/searchResponse/searchResultEntry">

this is selecting batchResponse and searchResponse in no-namespace.
which selects nothing in your document.

add

xmlns:D="urn:oasis:names:tc:DSML:2:0:core"
to xsl:stylesheet then use

<xsl:for-each
select="D:batchResponse/D:searchResponse/D:searchResultEntry">

and similarly prefix all other references to this namespace.

David
Jul 20 '05 #3

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

Similar topics

5
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
4
by: mikeyjudkins | last post by:
I have an XML file containing localized strings in 9 languages, encoded in Unicode (UTF-8). Im trying to parse this XML document via XSLT (Apache Xalan) to selectively render localized strings...
3
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform ...
5
by: Jiho Han | last post by:
I do a transform of an xml document into another xml using XslTransform. In my xsl file, I specify using <xsl:output encoding="utf-8"/>. However, when my transform is done, the resulting xml is in...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
1
by: VINITAG | last post by:
<LineItem>pediatric...
1
by: CAM123 | last post by:
I have added: <br><xsl:value-of select="Line" /></br> to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However...
1
by: Jeff.Thorn | last post by:
Hello All, I have a collection of data objects that are based on my application's data model. I want to be able to serialize this data to different XML formats (schemas) for use by different...
0
by: mannem | last post by:
I have a problem in accessing the values while transforming an XML using XSLT BODY { FONT: x-small 'Verdana'; MARGIN-RIGHT: 1.5em } .c { CURSOR: hand } .b { FONT-WEIGHT: bold; COLOR: red;...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.