Thanks Martin that's brilliant; I would have never figured that
myself. I've gotten as far as the code below, but it doesn't seem to
like my for-each params, which I have based upon your example. It
doesn't output anything, but doesn't through an error either. Any
ideas what I've done wrong?
Thanks once again,
Chris.
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:nhs="nhs.uk">
<xsl:template match="/">
<xsl:for-each select="nhs:OrganisationList/nhs:Organisation">
<xsl:value-of select="nhs:OrganisationList/nhs:Organisation/
nhs:PremisesList/nhs:Premises/nhs:ContactDetails/nhs:Fax"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="OrganisationList">
</xsl:template>
</xsl:stylesheet>
On Jun 18, 1:00 pm, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
Chrism2671 wrote:
Quote:
I'm new to XSLT/XML and I have a very simple, quick question. i've
been trying to convert simple xml files into CSV files and have made a
simple XSLT template using the w3 tutorials, but it doesn't seem to
display anything. It does display plain text I enter into the
templates, the value-of tags just render whitespace.
|
>
Quote:
If anybody can write a template of just a few lines just to
demonstrate how to get it to display something from this XML I would
be very very very appreciative.
|
>
Quote:
<OrganisationList xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="nhs.uk">
|
>
^^^^^^^^^^^^^^
With that default namespace declaration your stylesheet needs to declare
that namespace too but bind a prefix to it so that your patterns and
XPath expressions match/select elements in that namespace:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:nhs="nhs.uk">
>
<xsl:output method="text"/>
>
<xsl:template match="/">
<xsl:value-of
select="nhs:OrganisationList/nhs:Organisation/nhs:PremisesList/nhs:Premises/nhs:ContactDetails/nhs:Fax"/>
</xsl:template>
>
</xsl:stylesheet>
>
--
>
Martin Honnen
http://JavaScript.FAQTs.com/
|