[KLUG Members] XML/DSML/XSL Transform Help
Adam Tauno Williams
awilliam at whitemice.org
Sat Nov 13 15:21:48 EST 2004
> It's been awhile since I've actually goofed around with XSLT, but I do
> remember matching being a bit of a trick sometimes. Of course, this
> being an at-work effort, I'd blame it on MSXML much of the time, but...
I'm just using "xsltproc <xsl file> <xml data>"
> I seem to recall this failing with MSXML. Rather than trying to match
> the root element, what you MIGHT want here is 'match="batchResponse"'
> > <result>
> > <xsl:for-each select="batchResponse/searchResponse/searchResultEntry">
> Then, DROP 'batchResponse/' from the path here. I know, it doesn't make
Okay, now I'm trying...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:oasis:names:tc:DSML:2:0:core">
<xsl:template match="batchResponse">
<result>
<xsl:for-each select="searchResponse/searchResultEntry">
<row>
<cn><xsl:value-of select="attr[@name='cn']/value"/></cn>
<birthdate><xsl:value-of
select="attr[@name='birthday']/value"/></birthdate>
<serialid><xsl:value-of
select="attr[@name='morrisonserialid']/value"/></serialid>
<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>
And I get, to me very oddly...
<?xml version="1.0"?>
1015
02/17/1948
That isn't XML!
> a lot of sense for one to work and the other not, but like I said, I
> seem to remember SOMETHING screwy like this causing me a buttload of
> headaches.
Yea, this seems like it should be straight forward.
> On the other hand, another thought comes to mind: perhaps you
> should include the xmlns="urn:oasis:names:tc:DSML:2:0:core" in your
> stylesheet? That MIGHT be throwing off your parser. I'd at least give it
> a shot, see if it makes a difference.
No, no difference.
More information about the Members
mailing list