[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Transforming a Loose Structure

Subject: Re: Transforming a Loose Structure
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Mar 2007 10:56:00 GMT
Re:  Transforming a Loose Structure
> How can i achieve my desired results?

it seems from your example that your transformation of sub is to defer
generating the subscript element until you reach text node descendents
of the original element, so that's:

<?xml version="1.0" encoding="UTF-8"?>
    <par>Test para <inline vertical-align="sub">test <inline 
font-style="italic">para1</inline> and more</inline> Test para</par>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="*">
      <xsl:copy-of select="@*"/>

  <xsl:template match="inline[@role='italic']">
    <emphasis role="italic"><xsl:apply-templates/></emphasis>

  <xsl:template match="inline[@vertical-align]">

  <xsl:template match="inline[@vertical-align='sub']//text()">
    <subscript><xsl:value-of select="."/></subscript>


$ saxon8 inline2.xml inline2.xsl
<?xml version="1.0" encoding="UTF-8"?><section>
    <par>Test para <subscript>test </subscript><inline font-style="italic"><subscript>para1</subscript></inline><subscript> and more</subscript> Test para</par>

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.