XSL Question #5

<xsl:if test="fTOC[starts-with(@filename, '5')]">
          <xsl:element name="Section1">
               <xsl:attribute name="titleRef">Section 1 - Section 
One</xsl:attribute>           
               <xsl:for-each select="fTOC[starts-with(@filename, '5')]">
                    <xsl:copy-of select="."/>
               </xsl:for-each>
           </xsl:element>
</xsl:if>

I am going through a list of files starting with '5' and placing them under 
"Section 1 - Section One", which is hard-coded right now. I want to name the 
titleRef dynamically... i.e if i get an item starting with '5', I would like 
to open the first such item and retrieve the value of <ChapterNum> and use 
that to fill the titleRef.

I am very new to xml transformations, can somebody plz help me with some 
code on how to accomplish this?

Thanks.
0
Gaurav (24)
8/9/2007 10:18:06 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
574 Views

Similar Articles

[PageSpeed] 24

Gaurav wrote:
> <xsl:if test="fTOC[starts-with(@filename, '5')]">

Are you sure this is what you mean? It will evaluate to TRUE if at least 
one fTOC element exists (as a child of the context node) which has a 
filename attribute starting with "5".

If what you meant was "if the (presumable sole) fTOC child element's 
filename attribute starts with "5" then what you need is 
test="starts-with(fTOC/@filename,'5')".

Without knowing what your current context is, it's not possible to know.

>           <xsl:element name="Section1">
>                <xsl:attribute name="titleRef">Section 1 - Section 
> One</xsl:attribute>           
>                <xsl:for-each select="fTOC[starts-with(@filename, '5')]">
>                     <xsl:copy-of select="."/>
>                </xsl:for-each>
>            </xsl:element>
> </xsl:if>
> 
> I am going through a list of files starting with '5' and placing them under 
> "Section 1 - Section One", which is hard-coded right now. I want to name the 
> titleRef dynamically... i.e if i get an item starting with '5', I would like
> to open the first such item and retrieve the value of <ChapterNum> and use 
> that to fill the titleRef.

It depends where ChapterNum is. I'm assuming here it's a child of your 
current context. You really need to post a complete minimal example.

<xsl:if whatever you decide is the right condition to apply here>
   <Section1 titleRef="Section {ChapterNum} - Section {***}">
     <xsl:copy-of select="fTOC[starts-with(@filename,'5')]"/>
   </Section1>
</xsl:if>

You don't say if you want the cardinal section number reproduced in 
words (where I've left ***). I don't know of a function that does this 
(but there may well be one somewhere).

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/
0
Peter
8/9/2007 11:24:30 PM
Thanks Peter.
I have a booklist that contains a list of all the files. I am trying to 
group the files that start with 5 under one header. lets say we have a few 
files like
5-1
5-2
5-3...

chapterNum contains the value that should be the header under which all the 
files starting with 5 should be held. This can be taken by opening the first 
'5' file i.e 5-1 and reading the chapterNum element from there.

Thanks again.

"Peter Flynn" wrote:

> Gaurav wrote:
> > <xsl:if test="fTOC[starts-with(@filename, '5')]">
> 
> Are you sure this is what you mean? It will evaluate to TRUE if at least 
> one fTOC element exists (as a child of the context node) which has a 
> filename attribute starting with "5".
> 
> If what you meant was "if the (presumable sole) fTOC child element's 
> filename attribute starts with "5" then what you need is 
> test="starts-with(fTOC/@filename,'5')".
> 
> Without knowing what your current context is, it's not possible to know.
> 
> >           <xsl:element name="Section1">
> >                <xsl:attribute name="titleRef">Section 1 - Section 
> > One</xsl:attribute>           
> >                <xsl:for-each select="fTOC[starts-with(@filename, '5')]">
> >                     <xsl:copy-of select="."/>
> >                </xsl:for-each>
> >            </xsl:element>
> > </xsl:if>
> > 
> > I am going through a list of files starting with '5' and placing them under 
> > "Section 1 - Section One", which is hard-coded right now. I want to name the 
> > titleRef dynamically... i.e if i get an item starting with '5', I would like
> > to open the first such item and retrieve the value of <ChapterNum> and use 
> > that to fill the titleRef.
> 
> It depends where ChapterNum is. I'm assuming here it's a child of your 
> current context. You really need to post a complete minimal example.
> 
> <xsl:if whatever you decide is the right condition to apply here>
>    <Section1 titleRef="Section {ChapterNum} - Section {***}">
>      <xsl:copy-of select="fTOC[starts-with(@filename,'5')]"/>
>    </Section1>
> </xsl:if>
> 
> You don't say if you want the cardinal section number reproduced in 
> words (where I've left ***). I don't know of a function that does this 
> (but there may well be one somewhere).
> 
> ///Peter
> -- 
> XML FAQ: http://xml.silmaril.ie/
> 
0
Gaurav (24)
8/10/2007 3:56:05 AM
Reply:

Similar Artilces:

Many twice tab on Exchange Administrator Console in 5.5
Hi everyone In my organization I have a small little problem. In Internet Mail Service Propertites in Microsoft Exchange Administrator 5.5 Console I have not 11 tabs but 24 tabs. Some of them occur twice or thrice. In this twice or thrice tab all information on this tab is this same. Sometime ago I modify Extention-Data Object Attributes in Raw mode. I modify this attribut at one on my 4 IMS Connectors. My modify consist on copy and paste this same information from this object attributes. Now on all my 4 IMS Connections I have to many tabs. Can anybody help me ? I'm sorry for my Englis...

Journal question
I would like to journal email and meetings for one contact and email and tasks for another. Can that be done? It seems from the Journal Options dialog that you have to journal all selected contacts using the same options, but I wanted to make sure that I'm not missing an option somewhere. Thanks Krista No, the journal options apply to all contacts, irrespective of what you really want to do. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be del...

ofstream question
Hi, when I write like that in UNICODE it's ok: ofstream binDataFile("c:\\test.bmp" , ios::out | ios::binary); but when TCHAR szFile [255]; _stprintf(szFile,_T("c:\\test.bmp")); ofstream binDataFile( (LPCSTR)szFile , ios::out | ios::binary); it doesn't work although I see szFile points to correct name. anybody can help? Probably I do something stupid... ofstream is not meant for UNICODE -- use wofstream, which will not work with ANSI strings. Use #ifdef UNICODE to compile with different classes. Note that unless you are using an OS that is Unicode-aware, t...

discount question #2
I need to setup a discount for every item in the rms. Let just say im selling cups that are all different ounces. If a customer buys two or more cups then every other cup will be a dollar off. What do you think will be the best way to set this up? Thank You for your time from store operations 2.0 help file on this subject: Mix and Match: Unit price Pricing schedule: In the Quantity column, enter the quantity the customer must buy in order to receive one of the prices in the other columns. In the Reg. Price column, enter the extended price for that quantity (the discounted price tim...

Basic Question StringReader (ReadXML)
Emm, i hava a problem with accessing Schema Fiends from the CRMQuery Result-XML. I tried to Access mit Schema-Fields using Dim users As New DataSet users.ReadXml(New StringReader(usersXml)) Dim myRow As DataRow For Each myRow In users.Tables("result").Rows Dim opportunityVO As New OpportunityVO Try opportunityVO.Name = myRow.Item("name") Catch ex As Exception System.Diagnostics.Debug.WriteLine("Accountid" + ex.Message) End Try '... Next BUT i also need the Account-ID which is - looking at the XML Structure - in the "accountid"-"t...

XSL feed-- Metadata -Deployement Mgr
hi when we publish from deployement manager the xsl files are getting changed!!! my question is from which table(or tables) of the MSCRM, the metadata for the XSL is feeded??? Thanks in advance OrganizationUIBase Mike greaterthantwo media Printable Quotes, Orders and Invoices, with line-item details, now available for MSCRM. http://www.greaterthantwo.com "Apple" <none@nospam.com> wrote in message news:ueXyX%233%23DHA.3536@TK2MSFTNGP10.phx.gbl... > hi > when we publish from deployement manager the xsl files are getting > changed!!! > > my question is fro...

Question for Suzanne Barnhill
I recently read an answer to a question where you indicated getting page numbers on Odd pages only, and sequentially, can be done with{({Page}+1)/2}. I tried it in a newly created file and it worked like a charm. A group at my company has a training guide template, and they would be interested in employing this, but, in there template, when I edit the field, as you suggested, the page number disappears. Even with nothing else in the footer I have tried various combintions of Different Odd/Even, Section Breaks, etc, and nothing else in the footer. Can you think of anything I mi...

MSPOS Questions/Needs (NOT RMS)
We are using MSPOS in a small coffee shop. There are a number of issues we'd like to know if anyone has found solutions for: * Adding gratuity to credit/debit transactions via XML receipt template * Adding gratuity to credit/debit transactions before settling transactions * Utilizing loyalty/gift cards with MSPOS MSR feature * Utilizing barcode PLU to assign customer specific discount (e.g., local school district employees receive a 10% discount and we'd like to be able to scan a bar code that automatically applies the discount) * Running report to display all transactions tha...

Pivot Table for survey data w/ questions as Rows & poss answrs as
Hi, I'm trying to use a Pivot Table to present some survey results, and could use a point in the right direction. Details: -------- - The first question is "what department do you work for?" - The rest of the questions all have the same possible answers (agree, strongly, disagree, strongly disagree). - The questions are the column headings in the source data set. In the Pivot Table, I'm looking to: ----------------------------------- - have the rows be the individual questions (col headings from data set) - have the columns be the four possible answer (col data from data...

Interesting Counting Question...HELP
I work in Recreation and thought that excel might be able to help us. Here is the background. I am running a sports league. Each week teams play and results are sent to us to post. Players that were penalized during the game are put onto a list and if they are penalized 3 times within 5 weeks they are suspended. Here is my question. Is there a formula in excel that would allow me to determine the 3 time offenders automatically. Example: Ted 5/29 Jay 6/5 David 6/5 John 6/12 Gustavo 6/12 Greg 6/12 Ernesto 6/26 Robert 6/26 Gustavo 6/26 Joel 7/10 Gustavo 7/10 Greg 7/10 Jose 7/24 Gus...

Question about fonts
Is there a *simple* way to find out where a particular font is used within a Publisher file? I have Pub 2000 and 2002 on Win 98SE. -- The problem with resting on your laurels is that eventually you are sitting on dead branches. JoAnn No why. -- That should have been 'no way'!!! -- Darn - "No, why?" would a been a better response. Oh well, back to my newsletter.......... -- The problem with resting on your laurels is that eventually you are sitting on dead branches. JoAnn "���M�S��Publisher���" <replytonewsgroup@nomail.com> wrote in m...

Average Question Again #3
I am confused as to what I should do. Thanks for all your help th answer I need is the average of a group of numbers. Maybe I entered th formula wrong I really am not sure what to do -- mikeee ----------------------------------------------------------------------- mikeeee's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1461 View this thread: http://www.excelforum.com/showthread.php?threadid=27013 ...

chart question #4
I have a reference line that I want to appear on my chart. It's a straight line (nothing complicated). I've drawn it, and it kind-a works, but everytime I change any data or resize the chart, etc. ... the line moves (then of course I need to look up where it was suppose to be, if I don't have a handy previous printout). Having to move a graphic line "accurately" in Excel is no treat!! Is there any way to lock that line with the chart? Alternatively, is there a way to input such a line another way, so that it remains static on the chart. I did enter a straight line ...

dl question
I create a dl.. Mail goes to the dl.. if there are no users associated with the dl what happens to the mail that is delivered to it. Where is it stored? tks angelo The mail is deleted or turfed by the transport categorizer. -Ade "Angelo" <angelo_correa@hotmail.com> wrote in message news:OjipvJxzDHA.1500@TK2MSFTNGP12.phx.gbl... > I create a dl.. Mail goes to the dl.. if there are no users associated with > the dl what happens to the mail that is delivered to it. Where is it > stored? > > tks > angelo > > tks ade "Ade Famoti [MSFT]" &l...

Question about USER INFO IN AD
Hi: How user can update own INFO into the acitvedirectory ? dos any tools to batch import and export? Greetings Jeff To give the users power to update their own information use Global Address Modify Tool. This Global Address Modify Tool is a simple executable file that comes with the Exchange 2000 Server resource kit. When a user runs the Global Address Modify Tool, he is presented with a screen that allows him to change all sorts of personal information, such as home business, fax and cell numbers, address, etc. To preserve security, users are allowed to update only their informat...

Combination Charts #5
I am trying to build a chart that contains stacked columns and standard columns. I have two sets of data: 1) 2005 sales by month for 6 categories (need for stacked chart) 2) 2006 total sales projection by month (need for standard columns). I want to put the like monthly columns (ie: stacked January 2005 sales, standard January 2006 sales projection) side by side for the entire year. I checked out the custom chart option but couldn't determine how to get to the above. Any suggestions? Mark See Stephen Bullen's Funchrt4.zip at http://www.oaltd.co.uk/excel/SBXLPage.asp#Charti...

Exchange Rules Question
We have just migrated from Notes to Exchange 2003 in a 2003 domain. So I am new and still learning. Is it possible to create a global rule on the Exchange server that would place a copy of an email sent to a user in a sub-folder of their inbox? For example, say I send an email to a distribution group with the subject of Dept. Policy. I want to create a rule that would copy the email to a folder called Policies in the user's inbox. Is this at all possible and how would I do this? Also, is there a good article that explains server side and client side rules? Thanks This should eas...

Pivot Table Questions
In my access pivot table some of the data in the sheet is not visible without scrolling. This is when I am in show detail view. When the row has 10-12 lines of data I can see it all, when it has 15 or more some of it is not visible without going into the detail and scrolling. 1. How do I increase the width of the rows so that all the detail is visible? 2. What's the best way to print a Pivot Table? Can I use a report? Thanks for any help. ...

XIRR question
This is a multi-part message in MIME format. ------=_NextPart_000_0010_01C71ADC.AAACD810 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have the following numbers/dates in an excel sheet A1:D3 1/1/2007 1/1/2008 1/1/2009 1/1/2010=20 $ (10) $ 1 =20 $ 2 $ 20 =20 I want to run an XIRR on the entire stream, something to the effect of = XIRR(A2:B2&C3:D3,A1:D1) This will not work. I could create a 4th row that sums rows 2 and 3 and = do XIRR(A4:D4,A1:D1) but I have literally 1000 o...

xsl:with-param fails in XSL that accepts arguments from XML control
Hi, why does with-param fail to send parameters to any templates in a stylesheet that also accepts arguments from the ASP.NET XML control? The argument from the XML control seems to be available to any template in the stylesheet, even if a parameter for the argument is NOT coded for a template call. On the other hand, any parameters coded for a template call don't seem to pass their values (the stylesheet doesn't crash - everything is still rendered). ASP.NET C# code that loads the xml control xmlCtrl.TransformSource="template.xsl"; XsltArgumentList args1 = new XsltArgum...

xsl:if and string function
I'm at my wit's end with this one. Within an xsl:if test, I'm not able to get 2 variables to properly evaluate if one of them is wrapped within a string function. <!-- This works --> <xsl:if test="$var:v141=&quot;true&quot;"> <!-- This doesn't work --> <xsl:if test="string($var:v141)=&quot;true&quot;"> I can't figure out why. The transformation is taking place within dotnet and the var:v141 is assigned through a function call and it doesn't matter if I return a boolean value or a string value ("true&quo...

question about IMF
Dear all: If I send the email out, will IMF learn the reception user and add them to white-list? If yes, where is the IMF database? Many thanks for your reply! IMF will not learn, but Outlook will allow you to automatically add people you send email to to your safe senders list. The safe senders list is stored with your mailbox on the server and IMF will respect it (as long as IMF didn't block it at the gateway). -GT "David" <david@idle.com.tw.nospam> wrote in message news:eFPi8qSyEHA.1524@TK2MSFTNGP09.phx.gbl... > Dear all: > > > > If ...

How To Restrict Access to Server (5.5) Distribution Lists
How do I Restrict Access to Server (5.5) Distribution Lists? I will need to do this from within the system administration tool. Thanks, BobW romiwf@hotmail.com Delivery Restrictions tab of each distribution list's properties. -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "BobW" <anonymous@discussions.microsoft.com> wrote in message news:37a901c42968$e6bd4dc0$a501280a@phx.gbl... > > How do I Restrict Access to Server (5.5) Distribution > Lists? > > I will need to do this from within the system > administr...

managed newsgroup questions
We have a support plan with microsoft, this is supposed to allow us to take part in the managed newsgroups. I have a few questions regarding this: In customersource under managed newsgroup maintenance, I have my email address set to be monitored and entered. On the discussion forum under my profile, the email address is set to the same address as in customersource except it has .(donotspam) on the end. Is this alright or do they need to match exactly? If so which one should be changed? Do I have to post questions in a special place other than the public discussion board if I want m...

Outlook Question #7
Gang, I have a client that I am working with and the strangest thing happened! I was working on a domain authentication issue and had to delete a user account from a computer. After this I recreate the user and no email, so strange! All of my client's emails are gone all of his personal saved emails everything, In fact I have to reconfigure the Outlook mail settings just to get email running. So the end result......I cant find the guys email and I have no idea what is going on! HELP!! Client OS XP Outlook 2002 patched Thanks Joe Hi, Even if you create a new user with...