问题描述
我被工作困住了。我必须在 XML、XSD 和 XSL 中列出一个列表,并将其显示在 HTML 中,并分开显示。我的意思是,每个人都有自己的空间。 MAIN、ASIDE 和页脚。 我快疯了,想了一千个想法。我不知道我哪里出错了。我已经多次接触代码,以至于原始代码丢失了,我不得不抢救一个备份副本。感谢您的帮助。
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="/">
<html><head>
<style type="text/css">
table,th,td {
border: 1px solid black;
}
{
}
</style>
</head><body>
<h1><strong> Fulgur Domun </strong></h1>
<xsl:apply-templates/>
</body></html>
</xsl:template>
<xsl:template match="TV">
<table>
<tr bgcolor="#4dd0e1">
<th>Departamento</th>
<th>marca</th>
<th>Modelo</th>
<th>Medidas</th>
<th>Conexion</th>
<th>Precio</th>
<th>Color</th>
<th>Imagen</th>
</tr>
<xsl:for-each select="/TV/articulo">
<xsl:sort select="precio"/>
<tr>
<td bgcolor="#4dd0e1"><xsl:value-of select="departamento"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="marca"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="modelo"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="medidas"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="conexion"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="precio"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="color"/></td>
<td>
<img width="50px" name="src">
<xsl:value-of select="imagen"/>
</img>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="AUdio">
<table>
<tr bgcolor="#4dd0e1">
<th>Departamento</th>
<th>marca</th>
<th>Modelo</th>
<th>Medidas</th>
<th>Conexion</th>
<th>Precio</th>
<th>Color</th>
<th>Imagen</th>
</tr>
<xsl:for-each select="/AUdio/articulo">
<xsl:sort select="precio"/>
<tr>
<td bgcolor="#4dd0e1"><xsl:value-of select="departamento"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="marca"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="modelo"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="medidas"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="conexion"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="precio"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="color"/></td>
<td>
<img width="50px" name="src">
<xsl:value-of select="imagen"/>
</img>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="ACCESORIOS">
<table>
<tr bgcolor="#4dd0e1">
<th>Departamento</th>
<th>marca</th>
<th>Modelo</th>
<th>Medidas</th>
<th>Conexion</th>
<th>Precio</th>
<th>Color</th>
<th>Imagen</th>
</tr>
<xsl:for-each select="/ACCESORIOS/articulo">
<xsl:sort select="precio"/>
<tr>
<td bgcolor="#4dd0e1"><xsl:value-of select="departamento"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="marca"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="modelo"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="medidas"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="conexion"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="precio"/></td>
<td bgcolor="#ff8f00"><xsl:value-of select="color"/></td>
<td>
<img width="50px" name="src">
<xsl:value-of select="imagen"/>
</img>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="articulos.xsl"?>
<tienda>
<TV>
<articulo>
<departamento>marron</departamento>
<marca>LG</marca>
<modelo>55 utf 1500</modelo>
<medidas>55"</medidas>
<conexion>4k</conexion>
<precio>1499€</precio>
<color>Plata</color>
<imagen>/img/tvlg.jpg</imagen>
</articulo>
<articulo>
<departamento>marron</departamento>
<marca>Samsung</marca>
<modelo>55 Q60T</modelo>
<medidas>55"</medidas>
<conexion>4K</conexion>
<precio>819€</precio>
<color>Negro</color>
<imagen>/IMG/TVSAMS.JPG</imagen>
</articulo>
<articulo>
<departamento>marron</departamento>
<marca>Sony</marca>
<modelo>65 KD-65AG9</modelo>
<medidas>65"</medidas>
<conexion>8K</conexion>
<precio>2999€</precio>
<color>Negro</color>
<imagen>/IMG/TVSONY.JPG</imagen>
</articulo>
<articulo>
<departamento>marron</departamento>
<marca>Philips</marca>
<modelo>65MK-O40</modelo>
<medidas>65"</medidas>
<conexion>8K</conexion>
<precio>1999€</precio>
<color>Blanco</color>
<imagen>/IMG/TVPHIL.JPG</imagen>
</articulo>
<articulo>
<departamento>marron</departamento>
<marca>Panasonic</marca>
<modelo>TX-JZjz1500e</modelo>
<medidas>48"</medidas>
<conexion>4K</conexion>
<precio>1199€</precio>
<color>Plata</color>
<imagen>/IMG/TVPANA.JPG</imagen>
</articulo>
</TV>
<AUdio>
<articulo>
<departamento>HIFI</departamento>
<marca>Panasonic</marca>
<modelo>SC-PM250EC</modelo>
<medidas>30x40</medidas>
<conexion>20w</conexion>
<precio>99,99€</precio>
<color>Gris</color>
<imagen>/IMG/HIFIPANA.JPG</imagen>
</articulo>
<articulo>
<departamento>HIFI</departamento>
<marca>Sony</marca>
<modelo>MHC-V11</modelo>
<medidas>40x20</medidas>
<conexion>2x30w</conexion>
<precio>199,99€</precio>
<color>Negro</color>
<imagen>/IMG/HIFISONY.JPG</imagen>
</articulo>
<articulo>
<departamento>HIFI</departamento>
<marca>LG</marca>
<modelo>OK55</modelo>
<medidas>90x30</medidas>
<conexion>500w</conexion>
<precio>259</precio>
<color>Negro</color>
<imagen>/IMG/HIFILG.JPG</imagen>
</articulo>
<articulo>
<departamento>HIFI</departamento>
<marca>Sony</marca>
<modelo>CMT-SBT20</modelo>
<medidas>Si</medidas>
<conexion>30x40</conexion>
<precio>99</precio>
<color>Plata</color>
<imagen>/IMG/HIFISONY_2.JPG</imagen>
</articulo>
<articulo>
<departamento>HIFI</departamento>
<marca>Phillips</marca>
<modelo>MCM 2300/12</modelo>
<medidas>No</medidas>
<conexion>10x20</conexion>
<precio>99,99€</precio>
<color>Gris</color>
<imagen>/IMG/HIFIPHIL.JPG</imagen>
</articulo>
<articulo>
<departamento>HIFI</departamento>
<marca> Denon </marca>
<modelo> Ceol Piccolo N5 </modelo>
<medidas> Si </medidas>
<conexion>40x30</conexion>
<precio> 1793,35€ </precio>
<color>Blanco</color>
<imagen>/Img/HIFIDENON.JPG</imagen>
</articulo>
</AUdio>
<ACCESORIOS>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Ardistel</marca>
<modelo>ViNint83</modelo>
<medidas>2m</medidas>
<conexion>hdmi</conexion>
<precio>50.06€</precio>
<color>Negro</color>
<imagen>/IMG/CABLARdis.JPG</imagen>
</articulo>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Hama</marca>
<modelo>00205005</modelo>
<medidas>1,50m</medidas>
<conexion>HDMI</conexion>
<precio>12,99€</precio>
<color>Negro</color>
<imagen>/IMG/CABLHAMA.JPG</imagen>
</articulo>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Hama</marca>
<modelo>0056581</modelo>
<medidas>2m</medidas>
<conexion>Antena</conexion>
<precio>12,99€</precio>
<color>Blanco</color>
<imagen>/IMG/CABLHAMA_ANTENA.JPG</imagen>
</articulo>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Star Tech</marca>
<modelo>HD2VGAMM3n</modelo>
<medidas>0,90m</medidas>
<conexion>DVI</conexion>
<precio>35,99€</precio>
<color>Negro</color>
<imagen>/IMG/CABLSTARTECH.JPG</imagen>
</articulo>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Woxter</marca>
<modelo>w-31544-rusb</modelo>
<medidas>15m</medidas>
<conexion>RGB</conexion>
<precio>19,99€</precio>
<color>Negro</color>
<imagen>/IMG/CABLWOXTER.JPG</imagen>
</articulo>
<articulo>
<departamento>CABLEADO</departamento>
<marca>Red Level</marca>
<modelo>M-dt2</modelo>
<medidas>5m</medidas>
<conexion>HDMI</conexion>
<precio>50.06€</precio>
<color>Blanco</color>
<imagen>/IMG/CABLREDLEV.JPG</imagen>
</articulo>
</ACCESORIOS>
</tienda>
XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="TV">
<xs:complexType>
<xs:sequence>
<xs:element name="departamento" type="xs:string"/>
<xs:element name="marca" type="xs:string"/>
<xs:element name="modelo" type="xs:string"/>
<xs:element name="medidas" type="xs:string"/>
<xs:element name="conexion" type="xs:string"/>
<xs:element name="precio" type="xs:decimal"/>
<xs:element name="color" type="xs:string"/>
<xs:element name="imagen" type="xs:hexBinary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AUdio">
<xs:complexType>
<xs:sequence>
<xs:element name="departamento" type="xs:string"/>
<xs:element name="marca" type="xs:string"/>
<xs:element name="modelo" type="xs:string"/>
<xs:element name="medidas" type="xs:string"/>
<xs:element name="conexion" type="xs:string"/>
<xs:element name="precio" type="xs:decimal"/>
<xs:element name="color" type="xs:string"/>
<xs:element name="imagen" type="xs:hexBinary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ACCESORIOS">
<xs:complexType>
<xs:sequence>
<xs:element name="departamento" type="xs:string"/>
<xs:element name="marca" type="xs:string"/>
<xs:element name="modelo" type="xs:string"/>
<xs:element name="medidas" type="xs:string"/>
<xs:element name="conexion" type="xs:string"/>
<xs:element name="precio" type="xs:decimal"/>
<xs:element name="color" type="xs:string"/>
<xs:element name="imagen" type="xs:hexBinary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)