[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: following-sibling on attributes
Som Dimitre Novatchev sa den 08.09.2003 13:56:
Dimitre, are you sure that these lines in your reply <xsl:otherwise> <xsl:value-of select=".."/> </xsl:otherwise> shouldn't be Yes, I am definitely, absolutely sure. In this case (and typically) I do Yes, I did, and without changing your code I get an error when trying to parse the results of the transformation into a JDOM tree. However, changing to <xsl:value-of select="."/> everything works as expected, and I'm happy as a lark. Right now, my mind is too blurry to see why that happens. But perhaps I was not clear about the context in which the templates are used. Below is the entire code: ><xsl:template match="IPS:TEXT"> <xsl:choose> <xsl:when test="@*"> <xsl:call-template name="TEXT_ATTRIBUTE_TO_ELEMENT"> <xsl:with-param name="attList" select="@*"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> ><!-- Templates below are used to change IPS:TEXT attributes into proper XHTML elements --> <xsl:template match="IPS:TEXT/attribute::node()" mode="ELEMENTNAME"><xsl:value-of select="local-name()"/></xsl:template> <xsl:template match="IPS:TEXT/@URL" mode="ELEMENTNAME">a</xsl:template> <xsl:template match="IPS:TEXT/@B" mode="ELEMENTNAME">b</xsl:template> <xsl:template match="IPS:TEXT/@I" mode="ELEMENTNAME">i</xsl:template> <xsl:template match="IPS:TEXT/@U" mode="ELEMENTNAME">u</xsl:template> <xsl:template match="IPS:TEXT/@TARGET" mode="ELEMENTNAME"/> <!-- TARGET is not an element, but is handled by @URL --> <xsl:template match="IPS:TEXT/@URL" mode="ATTRIBUTES"> <attr name="href"><xsl:value-of select="."/></attr> <xsl:if test="../@TARGET"> <attr name="target"><xsl:value-of select="../@TARGET"/></attr> </xsl:if> </xsl:template> Sample XML fragment: <IPS:TEXT B="1" I="1">Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</IPS:TEXT> <IPS:TEXT URL="ps://237;393" TARGET="_blank">Lorem ipsum dolor sit amet.</IPS:TEXT> <IPS:TEXT B="1">Lorem ipsum dolor sit amet</IPS:TEXT> This transforms very nicely into: <b><i>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet</i></b> <a href="ps://237;393" target="_blank">Lorem ipsum dolor sit amet.</a> <b>Lorem ipsum dolor sit amet</b>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|