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

Re: Could XPath identify markup generated in XSL?

Subject: Re: Could XPath identify markup generated in XSL?
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Apr 2011 19:15:23 -0400
Re:  Could XPath identify markup generated in XSL?
At least in this case, you don't really need to process the results of
the XSLT.  Rather, change your XSLT to copy each node separately,
rather than copying the whole document with <xsl:copy-of>.  Most nodes
will be handled with an "identity template":

<xsl:template match="@* | node()">
    <xsl:copy><xsl:apply-templates select="@* | node()"/></xsl:copy>
</xsl:template>

To invoke this, replace the <xsl:copy-of> in your match="/" template with:

<xsl:apply-templates select="document('gui.xml')/*"/>

This template will automatically be low priority, so more specific
templates will take precedence, such as your template for the "app"
element (which, by the way, doesn't need the leading "//" in the
"match" attribute).

-Brandon :)


On Tue, Apr 12, 2011 at 6:51 PM, Khan, Noel <Noel.Khan@xxxxxxxxxxxxxx> wrote:
> XSL version: 1
> Vendor: Microsoft
> Vendor URL: http://www.microsoft.com
> Upgrade to XSLT 2 not viable
> ================================
>
> Suppose an XML file ("A") references an XSL file.
> That XSL file copies a node-list from another XML file ("B").
> Among other things, B contains the element "<that>".
> Within the XSL, can I now target <that> for XSLT?
>
> If XSL can't identify/query for markup that it itself generated, are
> there alternative approaches to solving this problem?
>
> ========= SAMPLE DATA ===========
>
>
> ENTRY.XML (aka, "A")
> {
>    <?xml version="1.0" encoding="utf-8" ?>
>    <?xml-stylesheet type="text/xsl" href="bind.xsl"?>
>    <root/>
> }
>
>
> GUI.XML {aka, "B")
> {
>        <html>
>            <head>
>                <link rel="stylesheet" href="style.css" type="text/css"
> />              </head>
>
>            <frameset rows="50,*">
>                <frame name="header" src="img/hdr.jpg" />
>                <frame name="body"><app/></frame>
>              <!--               ^^^^^      -->
>            </frameset>
>        </html>
> }
>
>
> BIND.XSL
> {
>        <?xml version="1.0" encoding="utf-8" ?>
>        <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>                <xsl:template match="/">
>                <xsl:copy-of select="document('gui.xml')" />
>                <xsl:apply-templates />
>                </xsl:template>
>
>
>          <!-- THE APP ELEMENT (BELOW) WAS JUST
>                COPIED FROM THE ABOVE "COPY-OF" -->
>
>            <xsl:template match="//app">
>                <xsl:copy-of select="document('app.aspx)" />
>            </xsl:template>
>        </xsl:stylesheet>
> }

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.