Subject: Re: Another newbie question From: Sanjay Saxena <ssaxena@xxxxxxxxxxxxx> Date: Wed, 08 Dec 1999 12:15:38 -0800 |
<FORMS>
<CONTAINERS>
<CONTAINER>
<PRE_HTML>DEPT_PREHTML</PRE_HTML>
<TITLE>Departments</TITLE>
<POST_HTML>DEPT_POSTHTML</POST_HTML>
</CONTAINER>
<CONTAINER>
<PRE_HTML>EMP_PREHTML</PRE_HTML>
<TITLE>Employees</TITLE>
<POST_HTML>EMP_POSTHTML</POST_HTML>
</CONTAINER>
</CONTAINERS>
<DEPT_PREHTML>
<!-- Well-formed
HTML. -->
<DIV id="Layer1"
style="position: absolute">
<IMG src="" width="917"
height="104"/>
</DIV>
</DEPT_PREHTML>
<DEPT_POSTHTML>
<!-- Some more well-formed
HTML. -->
</DEPT_POSTHTML>
<EMP_PREHTML>
<!-- Some more well-formed
HTML. -->
</EMP_PREHTML>
<EMP_POSTHTML>
<!-- Some more well-formed
HTML. -->
</EMP_POSTHTML>
</FORMS>
I tried to use the complete path /FORMS/DEPT_PREHTML and /FORMS/DEPT_POSTHTML
as values for PRE_HTML and POST_HTML elements, respectively. It
still does
not work. The XSL stylesheet looks as shown below:
<xsl:template match="/FORMS/CONTAINERS">
<xsl:for-each select="CONTAINER">
<xsl:copy-of select="//*[name(.)=current()/PRE_HTML]" />
<!-- Do some more things here -->
<xsl:copy-of select="//*[name(.)=current()/POST_HTML]" />
</xsl:for-each>
</xsl:template>
I tried using xsl:variable as suggested by another post and that
did
not work either. I am not seeing the node containing the well-formed
HTML getting copied to the output.
Thanks again,
-- Sanjay
David Carlisle wrote:
<xsl:template match="/CONTAINERS">
This only works if CONTAINERS is the document element but you indicated
I think that your DEPT_POSTHTML elements were outside this.<xsl:copy-of select="PRE_HTML"
<xsl:apply-templates select="*|@*|text()"/>
</xsl:copy-of>you are confusing the syntax for xsl:copy and xsl:copy-f. and also
that select _expression_ starts from the current CONTAINER node, but
PRE_HTML isn't a child of that.So....
===========================================
<x>
<CONTAINERS>
<CONTAINER>
<PRE_HTML>DEPT_PREHTML</PRE_HTML>
<TITLE>Departments</TITLE>
<POST_HTML>DEPT_POSTHTML</POST_HTML>
</CONTAINER>
<CONTAINER>
<PRE_HTML>EMP_PREHTML</PRE_HTML>
<TITLE>Employees</TITLE>
<POST_HTML>EMP_POSTHTML</POST_HTML>
</CONTAINER>
</CONTAINERS><DEPT_PREHTML>
<DIV id="Layer1" style="position: absolute">
<IMG src="" width="917"
height="104"/>
</DIV>
</DEPT_PREHTML><DEPT_POSTHTML>
<!-- Some more well formed HTML. -->kkk
</DEPT_POSTHTML></x>
===========================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
><xsl:output method="xml" indent="yes"/>
<xsl:template match="CONTAINERS">pppp
<xsl:for-each select="CONTAINER">l<xsl:copy-of select="//*[name(.)=current()/PRE_HTML]" />
<!-- Do some more things here -->
<xsl:copy-of select="//*[name(.)=current()/POST_HTML]" />
</xsl:for-each>
</xsl:template></xsl:stylesheet>
===========================================
David
PS you see it is better to ask on the list, than to ask directly:-)PPS You mail was included twice, once as text and once a HTML, please
don't do that.XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Another newbie question, David Carlisle | Thread | Re: Another newbie question, David Carlisle |
RE: xsl-list archive, Mike Brown | Date | IE5: generating element with variab, Kenneth J. Hughes |
Month |