473,698 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:styleshe et 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_Da tes/Studio_Appt_Dat e_Times">
<ItWorked>YEA H</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:schemaLocat ion="http://www.tempuri.org/DataSet_Studio_ Appt_Dates.xsd
C:\ARESEA~1\Get StudioApptDates .xsd">
<RequestInfo>
<returncode>1 </returncode>
<returnmsg>Succ ess.</returnmsg>
</RequestInfo>
<Studio_Appt_Da te_Times>
<bus_unit_id>24 05</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_des cr>Before Noon</time_range_desc r>
</Studio_Appt_Dat e_Times>
<Studio_Appt_Da te_Times>
<bus_unit_id>24 05</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_des cr>Before Noon</time_range_desc r>
</Studio_Appt_Dat e_Times>
</DataSet_Studio_ Appt_Dates>

Aug 3 '07 #1
7 2876
JoelBrimm wrote:
<?xml version="1.0"?>
<xsl:styleshe et 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_Da tes/Studio_Appt_Dat e_Times">
<xsl:for-each
select="da:Data Set_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:styleshe et 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_Da tes/Studio_Appt_Dat e_Times">

<xsl:for-each
select="da:Data Set_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:Stud io_Appt_Date_Ti mes[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:styleshe et 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_Da tes/Studio_Appt_Dat e_Times">

<xsl:for-each
select="da:Data Set_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:Stud io_Appt_Date_Ti mes[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:Stud io_Appt_Date_Ti mes[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.Namespa ce = 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:Stud io_Appt_Date_Ti mes[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_A ppt_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:Stud io_Appt_Date_Ti mes[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
2225
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
9552
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 where node ordering matters, and also the case where it doesn't, but perhaps that is an advanced topic). Ideally the method should be available to xpath expressions, so I think that creating new templates which compare nodes will not work (well,...
4
1829
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
2874
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
4085
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 Count of the nodes and i get the programDescription node but it duplicates for the selected "Code" Node. So if the Count is 3 its shows values "Crazy Training 2" 3 times for Code "PRG004" Any help?
6
1827
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 quite answer all my questions. How would one create a 3 level TOC when each item level / node was differently named (They used Template match and for-each, but the template match worked as on a 3 level structure they usedf the same named xml...
18
2076
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
8
15895
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 case that i don't know how to solve, I need to concat a string from multiple childs into a standard way, the following is an example of the source and the target XML.
2
22771
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 in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
0
8676
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.