[KLUG Members] XML/DSML/XSL Transform Help

Adam Tauno Williams awilliam at whitemice.org
Mon Nov 15 06:01:12 EST 2004


> > That isn't XML!
> No, but it's more than blank output, which I THINK is what you were
> getting before? 

Yep, I either get that or nothing.  Rather baffling.

> Now, let me think, here. I basically made TWO
> suggestions: add the namespace declaration, and change those two match
> settings. It looks like you're trying both together here. Have you tried
> them separately? If not, I'd recommend that, and see how the results
> differ, if they do.

The namespace declaration doesn't seem to matter (and I haven't need
them to make other XML transforms work).

and

<xsl:template match="batchResponse">
<result>
  <xsl:for-each select="searchResponse/searchResultEntry">
   <row>

produces the raw output, without my XML tags, and

<xsl:template match="/">
<result>
  <xsl:for-each select="batchResponse/searchResponse/searchResultEntry">
   <row>

produces

<?xml version="1.0"?>
<result/>

> It does seem odd that your non-XSLT elements aren't being preserved.
> xsltproc SHOULD be passing those through as-is, except for the xsl:
> elements, which obviously it's supposed to process and replace with the
> results. I'm not sure what the problem is there.

Right,  I really don't think it is getting into the for loop - somehow.
But then why does ANY data appear? 

> Something I would suggest is to start with an extremely simple template
> and build on it. If you've done this a lot, this is probably going to
> sound like a nursery school lesson, but I'd start with a template with
> just a line of raw text, and adjust its match 'til you start getting
> output.

You mean like

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="batchResponse">
 <result>
  <xsl:for-each select="searchResponse/searchResultEntry">
   <row>
     Row
   </row>
  </xsl:for-each>
 </result>
</xsl:template>
</xsl:stylesheet>

Yep, it produces a dump of the raw input.  WTH?

> be. Around that point, add a non-XSLT element (an empty one) to the
> template and see if that gets dumped to output as tags or not.

Nope, never appears

> these guides from Mulberry Technologies helpful. They have quick
> references both for XML and XSLT. They're pdf files you can download
> from http://www.mulberrytech.com/quickref/index.html.

Nice.



More information about the Members mailing list