Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Back in the Day ..

1 view
Skip to first unread message

brian....@gmail.com

unread,
May 2, 2006, 8:34:18 AM5/2/06
to
I used to be able to XSL transform just about any XML using either
MSXML or XSLTransform using syntax such as the following :

<xsl:template match="/">
<html>
<body>
<p style="text-align:center;">
<b>
Purchase Request
</b>
</p>
<xsl:for-each
select="PurchaseRequestReportData/PurchaseRequest">
<table>
<tr>
<td>Request # :</td>
<td>
<xsl:value-of select="PRNo" />
</td>
</tr>
<tr>
<td>Request Date :</td>
<td>
<xsl:value-of select="CreateDate" />
</td>
</tr>
</table>
</xsl:for-each>
<xsl:apply-templates></xsl:apply-templates>
</body>
</html>
</xsl:template>

Now I can not get the browser to render anything other than the data,
which leads me to question whether my Transform is doing anything at
all. In one post, it was suggested that there needs to be some XSL
code for constructing these HTML elements I want. What? "If that's
movin' up then I'm movin' out"

Any help gang?

Martin Honnen

unread,
May 2, 2006, 8:56:53 AM5/2/06
to

brian....@gmail.com wrote:

> I used to be able to XSL transform just about any XML using either
> MSXML or XSLTransform using syntax such as the following :

> Now I can not get the browser to render anything other than the data,
> which leads me to question whether my Transform is doing anything at
> all.

How does you XML input look then? We can't tell by looking at the XSLT
alone whether it suits the XML to transform it to HTML.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

brian....@gmail.com

unread,
May 2, 2006, 9:37:56 AM5/2/06
to
Thanks for the quick inquiry into my problem. Here is the XML I am
struggling to Transform with the aforementioned XSL :

<PurchaseRequestReportData
xmlns="http://tempuri.org/PurchaseRequestReportData.xsd">
<PurchaseRequest>
<AttentionEmail />
<CreateDate>2006-04-28T15:56:59.013-04:00</CreateDate>
<CreatorEmail />
<CreatorID>3</CreatorID>
<CreatorName />
<PRNo>152</PRNo>
<ReceiverEmail>Brian...@mcdean.com</ReceiverEmail>
<ReceiverFaxNumber />
<ReceiverName>BRIAN O</ReceiverName>
<ReceiverPhoneNumber>571 555 7777</ReceiverPhoneNumber>
<SendCreatorEmail>true</SendCreatorEmail>
<SendEmailWhenArrive>false</SendEmailWhenArrive>
<ShippingAddressId>8</ShippingAddressId>
<ShippingWarehouseID>0</ShippingWarehouseID>
<SpecialInstruction />
<StatusID>4</StatusID>
<Attention />
<Address1>My Street</Address1>
<Address2>1 Main Street</Address2>
<Address3/>
<City>MyTown</City>
<State>VA</State>
<Zip>70001</Zip>
<Country>USA</Country>
<IsResidential>true</IsResidential>
<ProductName>POWER SUPPLY</ProductName>
<PartNo>PC4702BP </PartNo>
<SuggestUnitPrice>127.00</SuggestUnitPrice>
<QTY>5.00</QTY>
<Unit>11</Unit>
<TotalPrice>635.00</TotalPrice>
</PurchaseRequest>
</PurchaseRequestReportData>

Martin Honnen

unread,
May 2, 2006, 9:55:41 AM5/2/06
to

brian....@gmail.com wrote:

> Thanks for the quick inquiry into my problem. Here is the XML I am
> struggling to Transform with the aforementioned XSL :
>
> <PurchaseRequestReportData
> xmlns="http://tempuri.org/PurchaseRequestReportData.xsd">

You need to take note of the default namespace declaration and adapt the
stylesheet as needed e.g.

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:prd="http://tempuri.org/PurchaseRequestReportData.xsd"
exclude-result-prefixes="prd">

<xsl:template match="/">
<html>
<body>

<h1>Purchase Request</h1>
<xsl:for-each
select="prd:PurchaseRequestReportData/prd:PurchaseRequest">


<table>
<tr>
<td>Request # :</td>
<td>

<xsl:value-of select="prd:PRNo" />


</td>
</tr>
<tr>
<td>Request Date :</td>
<td>

<xsl:value-of select="prd:CreateDate" />


</td>
</tr>
</table>
</xsl:for-each>

</body>
</html>
</xsl:template>

</xsl:stylesheet>

brian....@gmail.com

unread,
May 2, 2006, 10:37:50 AM5/2/06
to
Awesome! It's all about the NameSpace.

This works and makes perfect sense. You have restored my sense of
order.

Thanks. I will BLOG about this promptly.

0 new messages