473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

New to XSLT and can't select even the first node... Any Help?

Hey, brand new to XSL and XSLT. I've downloaded an evaluation copy of XML
Spy to debug my transformation, but I can't get to frist base.

Can anyone help my get straightened out?

My XSLT is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" />
<xsl:template match="/">
<xsl:for-each select="DataSet_Studio_Appt_Dates/Studio_Appt_Date_Times">
<ItWorked>YEAH</ItWorked> </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and my abbreviated XML is:

<?xml version="1.0" encoding="utf-8"?>
<DataSet_Studio_Appt_Dates
xmlns="http://www.tempuri.org/DataSet_Studio_Appt_Dates.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.tempuri.org/DataSet_Studio_Appt_Dates.xsd
C:\ARESEA~1\GetStudioApptDates.xsd">
<RequestInfo>
<returncode>1</returncode>
<returnmsg>Success.</returnmsg>
</RequestInfo>
<Studio_Appt_Date_Times>
<bus_unit_id>2405</bus_unit_id>
<sched_date>8/5/2007 12:00:00 AM</sched_date>
<sched_day_text>Sun</sched_day_text>
<sched_time>11:00:00</sched_time>
<time_range_descr>Before Noon</time_range_descr>
</Studio_Appt_Date_Times>
<Studio_Appt_Date_Times>
<bus_unit_id>2405</bus_unit_id>
<sched_date>8/5/2007 12:00:00 AM</sched_date>
<sched_day_text>Sun</sched_day_text>
<sched_time>11:30:00</sched_time>
<time_range_descr>Before Noon</time_range_descr>
</Studio_Appt_Date_Times>
</DataSet_Studio_Appt_Dates>

Aug 3 '07 #1
7 2867
JoelBrimm wrote:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Add
xmlns:da="http://www.tempuri.org/DataSet_Studio_Appt_Dates.xsd"
then use that prefix 'da' to qualify element names e.g.
<xsl:for-each select="DataSet_Studio_Appt_Dates/Studio_Appt_Date_Times">
<xsl:for-each
select="da:DataSet_Studio_Appt_Dates/da:Studio_Appt_Date_Times">

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #2
Thanks! I beat my head against the wall for 2 days before even thinking of
posting here and you gave me the answer in 10 minutes....

It works like a champ! Now I get to put back in my nested groups and play
with that!

"Martin Honnen" wrote:
JoelBrimm wrote:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Add
xmlns:da="http://www.tempuri.org/DataSet_Studio_Appt_Dates.xsd"
then use that prefix 'da' to qualify element names e.g.
<xsl:for-each select="DataSet_Studio_Appt_Dates/Studio_Appt_Date_Times">

<xsl:for-each
select="da:DataSet_Studio_Appt_Dates/da:Studio_Appt_Date_Times">

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #3
Tried to apply this to a more complex statement...

<xsl:for-each select="da:Studio_Appt_Date_Times[generate-id() =
generate-id(key('dates',da:sched_date)[1] ) ]">

but it did not like it.... Am I going overboard?

Thanks!
Joel.

"Martin Honnen" wrote:
JoelBrimm wrote:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Add
xmlns:da="http://www.tempuri.org/DataSet_Studio_Appt_Dates.xsd"
then use that prefix 'da' to qualify element names e.g.
<xsl:for-each select="DataSet_Studio_Appt_Dates/Studio_Appt_Date_Times">

<xsl:for-each
select="da:DataSet_Studio_Appt_Dates/da:Studio_Appt_Date_Times">

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #4
JoelBrimm wrote:
Tried to apply this to a more complex statement...

<xsl:for-each select="da:Studio_Appt_Date_Times[generate-id() =
generate-id(key('dates',da:sched_date)[1] ) ]">

but it did not like it.... Am I going overboard?
What does "did not like it" mean exactly? Do you get an error message?
Which one exactly?
Or do you not get the result you want? In that case post the input XML
and show us how you define that key.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #5
While debugging, When XML Spy hits that select and I step in, it pops up
"Finished Debugging" just like it did when I didn't have the namespace on the
simple select.

"Martin Honnen" wrote:
JoelBrimm wrote:
Tried to apply this to a more complex statement...

<xsl:for-each select="da:Studio_Appt_Date_Times[generate-id() =
generate-id(key('dates',da:sched_date)[1] ) ]">

but it did not like it.... Am I going overboard?

What does "did not like it" mean exactly? Do you get an error message?
Which one exactly?
Or do you not get the result you want? In that case post the input XML
and show us how you define that key.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #6
Actually, I figured out that if I set the dataset.Namespace = nothing before
I xmldoc.loadxml(dataset.getxml) then I don't have to worry about namespace
and all of those prefixes.... Now I just have to learn how to do grouping
correctly.

By the way - if you spot a mistake in the line below, I'd appreciate the
correction.

<xsl:for-each select="Studio_Appt_Date_Times[generate-id(.) =
generate-id(key('dates',sched_date)[1] ) ]">
Thanks for all of your help!
"Martin Honnen" wrote:
JoelBrimm wrote:
Tried to apply this to a more complex statement...

<xsl:for-each select="da:Studio_Appt_Date_Times[generate-id() =
generate-id(key('dates',da:sched_date)[1] ) ]">

but it did not like it.... Am I going overboard?

What does "did not like it" mean exactly? Do you get an error message?
Which one exactly?
Or do you not get the result you want? In that case post the input XML
and show us how you define that key.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #7
Found my problem with grouping....

I needed to add the line:
<xsl:key name="dates" match="Studio_Appt_Times" use="sched_date" />

Thanks again for all your help and I'll try to stop buggin' ya.

Joel.

"Martin Honnen" wrote:
JoelBrimm wrote:
Tried to apply this to a more complex statement...

<xsl:for-each select="da:Studio_Appt_Date_Times[generate-id() =
generate-id(key('dates',da:sched_date)[1] ) ]">

but it did not like it.... Am I going overboard?

What does "did not like it" mean exactly? Do you get an error message?
Which one exactly?
Or do you not get the result you want? In that case post the input XML
and show us how you define that key.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 3 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ruthless | last post by:
hello. All XML and XSLT are processed by preprocessor as a trees. How can i simply display my XML as some kind of tree. given xml: <struct> <node level="1" no="1">
5
by: inquirydog | last post by:
Hi- Does anyone know a way to compare whether two nodes contain the same information in xslt (the name, attributes, and all content recursivly should be the same. I am interested in the case...
4
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
5
by: Douglas Steen | last post by:
Here's what I have (in snippets) ** XML ** <parent> <child> <grandchild/> </child> </parent> ** XSLT ** <xsl:template match="/parent">
1
by: Patrick.O.Ige | last post by:
I have a xml file and i want to format it using XSL My XSL file and XML below I needed to do a distinct which is ok on the first node "Code" For the "programDescription" i did below which gets the...
6
by: Neal | last post by:
Hi All, I used an article on XSLT and XML and creating a TOC written on the MSDN CodeCorner. ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/dncodecorn/html/corner042699.htm However, it did'nt...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
8
by: Hercules Dev. | last post by:
Hi all, I'm new in xslt and xpath, so my question might be simple but i'm learning. I have an XML document and need to transform it into another XML, I use xslt and it works, but there is a...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.