This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Identity Transform and Default Templates, I think...


Schneeman, Brent wrote:
That sheet works fine (using Xalan2-J). But now I'd like to make it a bit
more flexible. I want to be able to identically copy elements which are not
matched by any explicit template.
Try adding the canonical copy-through template
 <xsl:template select="node()|@*">
   <xsl:copy>
     <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
 </xsl:template>

BTW:
  <xsl:template match="BD">
    <!-- output Body element -->
    <Body>
      <!-- grab the id attribute -->
      <xsl:attribute name="id">
        <xsl:value-of select="attribute::id"/>
      </xsl:attribute>
You can write this as
   <xsl:template match="BD">
     <!-- output Body element -->
     <Body id="{@id}">

(Look up "attribute value template" and shorthands
for XPath axes)

J.Pietschmann


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]