M
Mark Smits
Hi, newbie needs help...
My from XML has a namespace defined with no prefix. I tried to create a XSL
that converts this from XML to another one. I tried it without that
namespace and with that namespace. No matter what I try, I can't get this to
work.
The only time I succeed is when deleting the namespace in the from XML file.
But that's no option...
Inserted below are a sample XML and XSL file and both have the name spaces.
Can someone please point me in the right direction: how to get the XSL to
work with that namespace declaration in the XML.
Thanks,
Mark
=============================================
XML
=============================================
<?xml version="1.0" encoding="UTF-8" ?>
<Report xmlns="urn:crystal-reports:schemas"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="urn:crystal-reports:schemas Untitled.xsd" >
<Details_1 SectionNumber="0">
<Klanten.Klantnummer
FieldName="{Klanten.Klantnummer}">ALFKI</Klanten.Klantnummer>
<Klanten.Bedrijf FieldName="{Klanten.Bedrijf}">Alfreds
Futterkiste</Klanten.Bedrijf>
<Klanten.Contactpersoon FieldName="{Klanten.Contactpersoon}">Maria
Anders</Klanten.Contactpersoon>
<Klanten.Functie
FieldName="{Klanten.Functie}">Vertegenwoordiger</Klanten.Functie>
<Klanten.Adres FieldName="{Klanten.Adres}">Obere Str. 57</Klanten.Adres>
<Klanten.Plaats FieldName="{Klanten.Plaats}">Berlijn</Klanten.Plaats>
<Klanten.Provincie FieldName="{Klanten.Provincie}"></Klanten.Provincie>
<Klanten.Postcode FieldName="{Klanten.Postcode}">12209</Klanten.Postcode>
<Klanten.Land FieldName="{Klanten.Land}">Duitsland</Klanten.Land>
<Klanten.Telefoonnummer
FieldName="{Klanten.Telefoonnummer}">030-0074321</Klanten.Telefoonnummer>
<Klanten.Faxnummer
FieldName="{Klanten.Faxnummer}">030-0076545</Klanten.Faxnummer>
</Details_1>
</Report>
=============================================
XSL
=============================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns="urn:crystal-reports:schemas"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xslutput method="xml"/>
<xsl:template match="/">
<xsl:apply-templates select="/Report/Details_1"></xsl:apply-templates>
</xsl:template>
<xsl:template match="Details_1">
<xsl:value-of select="Klanten.Klantnummer"/>
</xsl:template>
</xsl:stylesheet>
My from XML has a namespace defined with no prefix. I tried to create a XSL
that converts this from XML to another one. I tried it without that
namespace and with that namespace. No matter what I try, I can't get this to
work.
The only time I succeed is when deleting the namespace in the from XML file.
But that's no option...
Inserted below are a sample XML and XSL file and both have the name spaces.
Can someone please point me in the right direction: how to get the XSL to
work with that namespace declaration in the XML.
Thanks,
Mark
=============================================
XML
=============================================
<?xml version="1.0" encoding="UTF-8" ?>
<Report xmlns="urn:crystal-reports:schemas"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="urn:crystal-reports:schemas Untitled.xsd" >
<Details_1 SectionNumber="0">
<Klanten.Klantnummer
FieldName="{Klanten.Klantnummer}">ALFKI</Klanten.Klantnummer>
<Klanten.Bedrijf FieldName="{Klanten.Bedrijf}">Alfreds
Futterkiste</Klanten.Bedrijf>
<Klanten.Contactpersoon FieldName="{Klanten.Contactpersoon}">Maria
Anders</Klanten.Contactpersoon>
<Klanten.Functie
FieldName="{Klanten.Functie}">Vertegenwoordiger</Klanten.Functie>
<Klanten.Adres FieldName="{Klanten.Adres}">Obere Str. 57</Klanten.Adres>
<Klanten.Plaats FieldName="{Klanten.Plaats}">Berlijn</Klanten.Plaats>
<Klanten.Provincie FieldName="{Klanten.Provincie}"></Klanten.Provincie>
<Klanten.Postcode FieldName="{Klanten.Postcode}">12209</Klanten.Postcode>
<Klanten.Land FieldName="{Klanten.Land}">Duitsland</Klanten.Land>
<Klanten.Telefoonnummer
FieldName="{Klanten.Telefoonnummer}">030-0074321</Klanten.Telefoonnummer>
<Klanten.Faxnummer
FieldName="{Klanten.Faxnummer}">030-0076545</Klanten.Faxnummer>
</Details_1>
</Report>
=============================================
XSL
=============================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns="urn:crystal-reports:schemas"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xslutput method="xml"/>
<xsl:template match="/">
<xsl:apply-templates select="/Report/Details_1"></xsl:apply-templates>
</xsl:template>
<xsl:template match="Details_1">
<xsl:value-of select="Klanten.Klantnummer"/>
</xsl:template>
</xsl:stylesheet>