Confused with XSLT

I am new to XSLT and am confused by this example.  If the {href} is
part of the img tag, then the value will appear,  however, when  I
specify "<span>{href}</span>", then the value of <href> will not
appear.  Is there a reason that one way works and the other does not?
Or do I need to use some  escape code to force printing?


Thanks

P.S.  I know that a way to print the item is "<xsl:value-of
select="href"/>"


==========================
<xsl:variable name="image-dir">/images</xsl:variable>

<xsl:template match="photograph">
<img src="{$image-dir}/{href}" width="{size/@width}"/>
</xsl:template>

With this source

<photograph>
  <href>headquarters.jpg</href>
  <size width="300"/>
</photograph>

the result would be

<img src="/images/headquarters.jpg" width="300"/>
0
dm_fw (2)
11/30/2006 10:32:22 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
417 Views

Similar Articles

[PageSpeed] 19

"David" <dm_fw@sbcglobal.net> wrote in message 
news:frmum214chncgsnpe9t6s3s65mitj29t4i@4ax.com...
>I am new to XSLT and am confused by this example.  If the {href} is
> part of the img tag, then the value will appear,  however, when  I
> specify "<span>{href}</span>", then the value of <href> will not
> appear.  Is there a reason that one way works and the other does not?
> Or do I need to use some  escape code to force printing?

The stuff in curley brackets {} are "attribute value templates". They only 
work in the specification of the value of an attribute. They cannot be used 
to specify the value of an element.

John


0
John
12/2/2006 7:15:30 PM
Reply:

Similar Artilces:

i am so confused
As of day before yesterday, i was recieving and sending mail like i should, but now it says my username and/or password are inncorrect, and they are stored in the com, and my phone. i retyped them, and it says the same thing??? i just tried again, and it said the following: The connection to the server has failed. Subject 'hi', Account: 'pop.att.yahoo.com (1)', Server: 'smtp.att.yahoo.com', Protocol: SMTP, Port: 465, Secure(SSL): Yes, Socket Error: 10061, Error Number: 0x800CCC0E Pleas help.... anyone!!!!! i am lost without my e-mail!! Your settings look ...

Sort by date [XSLT]
Is there a way to use <xsl:sort> to sort by date. Sample xml doc I want to perform sorting on --------------------------------------------- <Parent> <child> <date>10/10/2003</date> <displayText>The text that should be displayed</displayText> </child> <child> <date>9/10/2001</date> <displayText>The text that should be displayed</displayText> </child> <child> <date>1/10/2002</date> <displayText>The text that should be dis...

CListCtrl confusion
I am confused about the meaning of selected (LVIS_SELECTED) and focused (LVIS_FOCUSED). What is the difference? The above can be set/read with Set/GetItemState(). The there is also GetSelectionMark() and its set. When you get the selection mark, is this the one that is selected? Or does it mean something else? What I am able to do is click on a row and then execute my method, doit(). Now I want to simply use the up and down arrow keys to move the selection and focus up and down the list, each time calling doit() for the new row. The problem I am running into is that I get recursive calls to...

Confused on syntax
Hello, I confused over the following syntax. Could someone please explain to me exactly what is happening here. ((CEditView*)m_viewList.GetHead())->SetWindowText(NULL); I understand the casted type to the m_viewList.GetHead( ) function, but the ->SetWindowText call on the end is what I've never seen done like this? Is somehow the return pointer from GetHead pointing to the SetWindowText function ? But why would this be? Could not SetWindowText just be called on it's own ? On 3 jul, 13:01, "RB" <NoMail@NoSpam> wrote: > Hello, I confused over the following...

(more!) elementFormDefault confusion
Hi all, From what I can read, it doesn't look like I'm the only one getting confused with the elementFormDefault and attributeFormDefault properties of XML schemas. I am wanting to get a full understanding of these properties, as I want to be able to generate XML that conforms to these settings via the XmlTextWriter. The two main reference articles I can find are: http://geekswithblogs.net/dmillard/archive/2004/10/20/12935.aspx http://blogs.msdn.com/ebattalio/archive/2006/03/03/543154.aspx However, I have a couple of questions regarding this: 1. In Minty Fresh's example, w...

Confused
I am using a shared computer at work. I have access help to resolve a simple problem and the answer is there. The big problem is that options it describes are not there for example how to set-up a signature some option names are not there and options it says should be available are different. Can someone help ?????? With the amount of missing information that you posted, probably not until the crystal ball has a nice vacation to rest up from overuse here. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus na...

.NET and XSLT id() #2
I must be an idiot because I STILL cannot coax .NET to successfully execute a transform which uses the XSLT id() function. Here's the bare-bones code: XmlValidatingReader xvr = new XmlValidatingReader( new XmlTextReader( @"s:\data\test.xml", new NameTable() ) ); xvr.EntityHandling = EntityHandling.ExpandEntities; xvr.ValidationType = ValidationType.Schema; xvr.ValidationEventHandler += new ValidationEventHandler( this.veh ); // this.veh() simply echos any validation errors. XslTransform xsl = new XslTransform(); xsl.Load( @"s:\data\test.xsl" ); XPathDocumen...

Still confused on whether this will work
Hi, I hope you can help with my question, and thanks in advance! In my use of MSMoney Plus Premium, I do bill payer through a bank directly (Wachovia) and download transactions directly using my web site passwords directly to those sites (T Rowe Price, Wachovia, Am Express for example). I am thinking this will still work after Feb 2011 (and my license goes that long), that I will still be able to get transactions automatically downloaded daily like I do now, and I can use the bank for billpayer through MSMoney? So the only thing I will lose is the stock price updates as they come fr...

confused???
I can't seem to figure out my windows email system. it asks for sever numbers and such??? if any one knows how to do it then let me know. Tisha S. wrote: > I can't seem to figure out my windows email system. it asks for sever > numbers and such??? if any one knows how to do it then let me know. ======================================= Maybe the following article will get you started: Windows Vista - Windows Mail: Setting up an account from start to finish http://tinyurl.com/yzf3t42 or..... http://windows.microsoft.com/en-US/windows-vista/Windows-Mail-sett...

OWA confusion.....
I am trying to figure out how to make OWA work behind my firewall.. I have referenced KB259240 (How to configure OWA to connect to exchange through a firewall) and therein lies my confusion.... It says to open 3 ports. 2 of them have to be statically configured in the registry. the first one located (added) at : HKLM\system\CurrentControlSet\Services\MSExchangeDS\parameters But that location does not exist on my system( Server 2003 / Exchange 2003 - SP1 I do have HKLM\system\CurrentControlSet\Services\MSExchangeDSAccess but the only keys under that are Diagnostics and performance. NOT P...

Confusing Email Problem
Sorry to bother you guys I have an email problem that is bugging me. I can recieve emails ok but when I send them, no one gets them. It appears to send and they even appear in the sent items folder but no one gets them. If I add large attachment the email will send in seconds. Something odd is going on. I use mail.onetel.net.uk. Port 25. When I called their call centre in India they said my account was active and they sent a test mail using their web based email system. They say it must be an outlook express problem. Yet I sent myself a test email using Telnet and still didn't ge...

.NET and XSLT id() #4
I must be an idiot because I STILL cannot coax .NET to successfully execute a transform which uses the XSLT id() function. Here's the bare-bones code: XmlValidatingReader xvr = new XmlValidatingReader( new XmlTextReader( @"s:\data\test.xml", new NameTable() ) ); xvr.EntityHandling = EntityHandling.ExpandEntities; xvr.ValidationType = ValidationType.Schema; xvr.ValidationEventHandler += new ValidationEventHandler( this.veh ); // this.veh() simply echos any validation errors. XslTransform xsl = new XslTransform(); xsl.Load( @"s:\data\test.xsl" ); XPathDocumen...

confused
I am totally confused. I have written a few win api C apps that actually compiled without errors and ran successfully. Now I'm trying to learn MFC. I having a bit of a problem getting a call to GetParent to work. Below is the offending function and compilation errors BOOL CMfcPipesApp::InitInstance() { // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. CMfcPipesApp *pModelessDlg = new CMfcPipesApp(); CWnd *ParentWnd; ...

Product confusion (cont.)
Further question to my earlier post: Is this correct: MoneyCentral changed to MSN Money. Then Money changed from free, to a purchased product. The free version no longer supports downloads from brokers and many of the charting options. To get broker downloads and many charting options, I need to purchase Money 2005. Is that correct? PS: Cal, thanks for your earlier reply. -- Bill In microsoft.public.money, Bill wrote: >Further question to my earlier post: >Is this correct: >MoneyCentral changed to MSN Money. I think it has gone under both names for a good while. > Th...

Confused...
I thought Exchange 2007 / 12 was only going to be 64-bit? Am I missing something? it is...what's confusing you? -- Susan Conkey [MVP] "JPAUL" <jpaul34@msn.com> wrote in message news:#Zdg6PVwGHA.1296@TK2MSFTNGP02.phx.gbl... > I thought Exchange 2007 / 12 was only going to be 64-bit? Am I missing > something? > > A 32-bit version is available for testing/training. It is not and will not be supported in production environments. The 64-bit version is the only one that will be supported in production once it is released. -- Bharat Suneja MVP - Excha...

confused about create and manual events
i made and activated a work-rule with these characteristics: entity type=account event=create the rule: when an account is created the territory is assigned based upon the owner. the test: i converted 3 leads into accounts. and then i waited 30 miuntes. the result: none of the three new accounts have their territory assignments. however, i then manually executed the rule and the assignments were made. the question: why didn't it make the proper assignment when the account was created via converting the lead to an account? and why would an 'account create' rule work manually...

namespaces in XSLT
Hi, I have an xml document that defines xmlns:p="foo" and an xslt stylesheet that defines xmlns:p="bar". Running the transformation using XslCompiledDocument in .Net 2.0, I get the following error message: Cannot construct namespace declaration xmlns='bar'. Prefix 'p' is already mapped to namespace 'foo'. The problem does not happen using xml spy's built-in XSLT engine. Unfortunately both the stylesheet and document are very large and I haven't managed to reproduce a simple example yet.. However, I thought namespace prefixes in the X...

Confusion with forms and related subforms
Hello, I'm trying to figure out the concept of embedding subforms into main forms. I have main tables, 4 junction tables, and a few look-up tables (not all look-ups are listed below). If I'm reading it correctly, the junction tables which relate to the main tables should be in the form of a subform placed within the main form they relate to? I'm lost on the fact that I believe I have a subform which appears should be on another subform which should then be on a form. If this is correct, the form looks extremely busy and not user friendly, and just plain incorre...

CONFUSED!
i am using publisher to make a brochure... i have created the first part, now how do i start doing the inside of the brochure??? Insert, page... -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "katie" <katie@discussions.microsoft.com> wrote in message news:E34CA105-D474-4A14-9143-6C605E4F7193@microsoft.com... >i am using publisher to make a brochure... i have created the first part, now > how do i start doing the inside of the brochure??? ...

Confused
I have the following macro in my Personal.xls workbook. Sub ShowFormulae() ActiveWindow.DisplayFormulas = Not ActiveWindow.DisplayFormulas ' test line End Sub I was able to add the comment ' test line to the macro without unhiding the workbook. I did not think this was possible. Windows | Unhide shows that it is hidden. Where am I confused? Brian Tozer Brian, Hiding a workbook has only effect on the "normal" (i.e. non VB view) In the VBE you can always see you workbooks. This also applies to hidden sheets in a workbook. (NB In the VBE it is possible that you ...

interfaces...I'm confused!
Hi. I have read tons of blog posts and articles about how and when to use interfaces. I have seen some people use them to define every object they create and I have seen some people say to not ever use them. Other people say not to use them unless you have some actions that multiple objects will use, an example is like this: You can have an interface that tells all breeds of cats that they must eat their food, sleep or even meow. Now, you have different kinds of cats: house cat, farm cat, tiger, lion, panther. All of these cats do the exact same thing, just in very different w...

Very confused
I have a live account. a while back in outlook it seems like somehow this account was added. I dont remember. My problem right now is that if I click a link in a web page to email, it opens up windows live mail in an outlook type format screen. the problem is it is sending from my yahoo and I've apparently entered the wrong server information. How do I fix it? If you go to Tools/Accounts menu item then look for your Yahoo account, select it then hit the properties button you can change the settings. Also here, if you wish you can set another account to be your default mai...

[ANN] ActiveState Releases Visual XSLT 2.0
ActiveState is pleased to announce the release of Visual XSLT 2.0. This release is a major upgrade from Visual XSLT 1.8, adding powerful new features to the complete XSLT development plug-in for Visual Studio .NET. New in Visual XSLT 2.0 * Just-In-Time (JIT) Debugging - Test XSLT code embedded in other applications or libraries built for the Microsoft .NET Framework. No need to provide any source code at all -- not for the application, not for the XSLT, not for the input. * Visual Schema Mapper - Visually generate XSLT-driven XML-to-XML transformations * Enhanced Project Mana...

Confused,simple math formula
If I have a 379 liter tank (K3) filled with water and I need 1.0 grams per liter (D3) to have the correct amount in the tank. If I'm over (B3) lets say 1.9 grams per liter. I need to decrease (G3) by .9 grams per liter. Since it's already mixed,how would I get J3 to show the amount of Gals removed to bring it back to (D3) 1 gram per liter. I thought k3*g3/d3/3.78 would work but if it's 2.0 grams over(B3) then is says to add 100 gals. 100 gals is the entire tank size. If I did that I'd need to add 1 gram per liter. Confused!? Thanks so much for your help!!! In article <2b2b...

XSLT in VB.Net
I am new to XSLT. AS I was browsing msdn.com for XSLT I found a an example for this. So, I tried to transform XML is DOM in VB.Net. But I am getting the following errors. Please help me. ERROR -------- An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication3.exe Additional information: The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document. VB.NET CODE --------------- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ...