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

RE: Automatically copying an element's attributes and

Subject: RE: Automatically copying an element's attributes and theirvalues
From: Mary McRae <marymcrae@xxxxxxxxxxxxx>
Date: Mon, 08 Sep 2003 09:34:46 -0400
w rfonts
Sorry, I'm sure the xsl is a bit more than you
expected. The attributes come through fine where I
explicitly create them; but no attribute shows up
on the acronym element where I've put in
<xsl:copy-of select="@*"/>

Thanks again for any help!

Mary

--------

Test input snippet:
<?xml version="1.0" encoding="utf-8"
standalone="no"?>
<paper xmlns="http://www.dmsi-world.com/ns/paper"
id="" level="" area="" presdate="" prestime=""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan
ce"
xsi:schemaLocation="http://www.dmsi-world.com/ns/p
aper DMSi_paper.xsd">
<para>Some text here <acronym.grp><acronym
refid="IC">IC's</acronym><expansion
id="IC">Intelligence
Community</expansion></acronym.grp> more text goes
here <acronym.grp><acronym
refid="HTML">HTML</acronym><expansion
id="HTML">HyperText Markup
Language</expansion></acronym.grp> final bit of
text.</para>
</paper>

-------

Test xsl snippet:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<?mso-application progid="Word.Document"?>
<xsl:stylesheet version="1.0"
 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
xmlns:w="http://schemas.microsoft.com/office/word/
2003/wordml"
 
xmlns:wx="http://schemas.microsoft.com/office/word
/2003/auxHint"
   xmlns:ns0="http://www.dmsi-world.com/ns/paper"
   xmlns:v="urn:schemas-microsoft-com:vml"
 
xmlns:w10="urn:schemas-microsoft-com:office:word"
 
xmlns:sl="http://schemas.microsoft.com/schemaLibra
ry/2003/core"
 
xmlns:aml="http://schemas.microsoft.com/aml/2001/c
ore"
 
xmlns:o="urn:schemas-microsoft-com:office:office"
 
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C1488
2"
 
xmlns:st1="urn:schemas-microsoft-com:office:smartt
ags"
   xml:space="preserve">

<xsl:template match="/">
<ns0:paper id="{ns0:paper/@id}"
level="{ns0:paper/@level}"
area="{ns0:paper/@area}"
presdate="{ns0:paper/@presdate}"
prestime="{paper/@prestime}">
<xsl:apply-templates/>
</ns0:paper>
</xsl:template>

<xsl:template match="ns0:para">
<xsl:choose>
<xsl:when test="@id">
<ns0:para id="{@id}">
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:cs="Arial"/>
<w:sz-cs w:val="20"/>
</w:rPr>
</w:pPr>
<xsl:apply-templates mode="para"/>
</w:p>
</ns0:para>
</xsl:when>
<xsl:otherwise>
<ns0:para>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:cs="Arial"/>
<w:sz-cs w:val="20"/>
</w:rPr>
</w:pPr>
<xsl:apply-templates mode="para"/>
</w:p>
</ns0:para>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="text()" mode="para">
<w:r>
<w:t><xsl:value-of select="."/></w:t>
</w:r>
</xsl:template>

<xsl:template match="ns0:acronym.grp" mode="para">
<ns0:acronym.grp>
<xsl:apply-templates/>
</ns0:acronym.grp>
</xsl:template>

<!-- testing version -->
<xsl:template match="ns0:acronym">
<ns0:acronym>
<xsl:copy-of select="@*"/>
<w:r>
<w:rPr>
<w:rStyle w:val="Acronym"/>
</w:rPr>
<w:t><xsl:apply-templates/></w:t>
</w:r>
</ns0:acronym>
</xsl:template>
<!-- end of test -->

<xsl:template match="ns0:expansion">
<xsl:choose>
<xsl:when test="@id">
<ns0:expansion id="{@id}">
<w:r><w:t> (<xsl:apply-templates/>)</w:t></w:r>
</ns0:expansion>
</xsl:when>
<xsl:otherwise>
<ns0:expansion>
<w:r><w:t> (<xsl:apply-templates/>)</w:t></w:r>
</ns0:expansion>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

-----------------

 
> No that has no bearing on the copying of the
attribute nodes.
> Show a (complete, small) sample input and
template...
> 
> David
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.