ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
[xsl] Re: xsl-list Digest 30 May 2006 05:10:00 -0000 Issue 791
by Chad Chelius other posts by this author
May 31 2006 10:57AM messages near this date
Re: [xsl] Creating a TOC where Alpha Character does not exist | [xsl] Dynamically ordering/displaying columns specified inside of xml
& XSLT I am trying to do something very similar to this as well. In my  
situation, I have the following XML file:

<document> 
	<title> 
	<subtitle> 

There are many more elements with the <document>  element but I'm  
focused one the ones listed above right now. I need to create an  
element called <group>  that is a parent to the <title> and <subtitle>  
elements so that my resulting file looks like this:

<document> 
	<group> 
		<titile> 
		<subtitle> 

I think my question correlates to this post, but I can't figure out  
how to incorporate it into my situation. I am certainly an XSLT  
newbie so I apologize if I'm off track here.


On May 30, 2006, at 1:10 AM, xsl-list-digest- 
help@[...].com wrote:

>  The above creates a single invoice line, not one per each following  
>  sibling.
> 
>  For help on "the start template statements etc." most XSLT books
>  discuss the top-level requirements for stylesheets.  There is a free
>  download on our web site of the first two chapters and all other
>  chapter introductions of the XSLT book we sell from our web site ...
>  you can see working examples there.  Check the links at the right
>  side of our home page linked blow.  There are also many web sites
>  with introductory information on XSLT.
> 
>  For the wrapping bit, I hope the code below helps.
> 
>  . . . . . . . . . . Ken
> 
>  T:\ftemp>type peter.xml
>  <invoices>
>    <invoiceHeader> ...</invoiceHeader>
>    <invoiceLine>... </invoiceLine>
>    <invoiceLine>... </invoiceLine>
>    <invoiceLine>... </invoiceLine>
>    <invoiceHeader>... </invoiceHeader>
>    <invoiceLine>... </invoiceLine>
>    <invoiceLine>... </invoiceLine>
>  </invoices>
> 
>  T:\ftemp>type peter.xsl
>  <?xml version="1.0" encoding="US-ASCII"?>
>  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                   version="1.0">
> 
>  <xsl:output indent="yes"/>
> 
>  <xsl:template match="invoices">
>     <invoices>
>       <xsl:for-each select="invoiceHeader">
>         <invoice>
>           <invoiceHeader><xsl:value-of select="."/></invoiceHeader>
>           <xsl:for-each select="following-sibling::invoiceLine[
>               count(preceding-sibling::invoiceHeader[1] | current())  
>  = 1]">
>             <xsl:copy-of select="."/>
>           </xsl:for-each>
>         </invoice>
>       </xsl:for-each>
>     </invoices>
>  </xsl:template>
> 
>  </xsl:stylesheet>
>  T:\ftemp>xslt peter.xml peter.xsl con
>  <?xml version="1.0" encoding="utf-8"?>
>  <invoices>
>      <invoice>
>         <invoiceHeader> ...</invoiceHeader>
>         <invoiceLine>... </invoiceLine>
>         <invoiceLine>... </invoiceLine>
>         <invoiceLine>... </invoiceLine>
>      </invoice>
>      <invoice>
>         <invoiceHeader>... </invoiceHeader>
>         <invoiceLine>... </invoiceLine>
>         <invoiceLine>... </invoiceLine>
>      </invoice>
>  </invoices>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@[...].com> 
--~--

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved