product-quantity 相关问题


指针和结构:为什么这个 C 代码不起作用?

我不明白为什么下面的代码尽管正确打印了产品名称,但无法正确显示产品编号。你能向我解释一下吗? #包括 我不明白为什么以下代码尽管正确打印了产品名称,但无法正确显示产品编号。你能给我解释一下吗? #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct products { char name_[4]; int number_; } Product; Product* createProduct(char* name, int number) { Product* new_product = malloc(sizeof(Product)); if(new_product == NULL) return NULL; new_product->number_ = number; strcpy(new_product->name_, name); return new_product; } int main() { Product* array[3]; array[0] = createProduct("Product 1", 0xAABBCCDD); array[1] = createProduct("Product 2", 0xFFAA33EE); array[2] = createProduct("Product 3", 0xBBCC7799); for(int i = 0; i < 3; i++) { Product* product = array[i]; printf("%s : 0x%X\n", product->name_, product->number_); free(product); } printf("Are all product numbers displayed correctly?\n"); return 0; } 元素 Product.name_ 可以容纳 3 个字符的字符串(加上 \0),但您传递了 strlen("Product 1") == 9,因此 strcpy() 将导致未定义的行为。考虑使用 strncpy() 或 memcpy() 并确保生成的数组已 \0 终止。


在 ASP.NET Core 7 WebAPI 上运行 React-App 构建

我有一个 ASP.NET Core 7 WebAPI,有很多路由,例如: domain.com/Api/Product/GetAll domain.com/Api/Product/Delete/ domain.com/Api/Product/Create ... 我有一个反应应用程序,我需要使用它


OData 实体名称/OData 休息端点中的特殊字符?

我有一个场景,我的实体名称可以包含特殊字符示例:“Product-abc”,这将使网址像这样 - ../odata/ProductService/Product-abc 然而,OData(Apache


.htaccess WordPress 站点中的分页重定向规则

人们! 我想将网址从“https://some-domain.com/.../?product-page=some-page-number”更改为“https://some-domain.com/.../page” /some-page-number" 使每个动态 p...


如何在razor页面ASP.Net Core 8中的“a”标签后添加逗号

我试图在 foreach 中的“a”标签后面添加逗号(,),如下所示: @foreach(Model.Product.Categories 中的 var 项目) { 我试图在 foreach 中的“a”标签后面添加逗号(,),如下所示: @foreach (var item in Model.Product.Categories) { <a href="#" class="product-link product-cat-title">@item.Name</a> , } 但我收到错误消息“} Expected”。我该怎么办? 我已经测试了@string.join(", ", Model.Categories.Select(p => p.Name).ToArray()),但这将返回字符串或文本。我要链接! 值得一提的是,我不想添加其他标签,例如 <span> 或 <a>。我知道他们有效。如果有人能解释为什么它不起作用,我将不胜感激? 谢谢 @foreach (var item in Model.Product.Categories) { <a href="#" class="product-link product-cat-title">@item.Name</a> <a >,</a> }


一旦特定变体发生变化,Woocommerce 就会动态更改可变产品的价格

我写这个是为了提取产品变化价格 全球$产品; if ( $product->is_type('variable') ) { 函数 get_product_variation_price($variation_id) { ...


从 adb shell 获取正在运行的 LineageOS 内核配置

我已经从源代码构建了 LineageOS 18.1 并在 ARM 设备上刷新了它。在构建主机上,我可以看到 lineage/out/target/product/jfltexx/obj/KERNEL_OBJ/.config 包含 KERNEL_IKCONFIG=y


使用 Blackmagic ATEM SDK 获取:无法解析的外部符号 CLSID_CBMDSwitcherDiscovery

我正在尝试开发一个应用程序来控制我的ATEM视频切换器,但在开始使用SDK时遇到困难(可在https://www.blackmagicdesign.com/developer/product/atem获取) 我明白了...


如何循环遍历从ObjectBox数据库生成的Flutter ListView图块?

我有一个 Flutter 应用程序,它使用 ObjectBox 来存储后端数据,这是 Product 对象的列表。我创建了一个 ListView Tile 小部件来显示名为 ProductTile 的数据。我生成一个列表...


如何使用依赖于第一个可观察数据的第二个可观察数据更新第一个可观察数据

在Android中使用Retrofit结合RxJava我得到一个Observable对象。里面我有一个清单;在表中,我有包含来自对象 Product 的外键的属性。 我的目标是获得


Vue.js v-for 不渲染图像

我正在尝试使用 v-for 渲染四个图像,范围为 1 到 4。 v-for="n in 4" :key"n" 但是,使用 'n' 作为 src 的一部分不起作用。为什么? 我正在尝试使用 v-for 渲染四个图像,范围为 1 到 4。 v-for="n in 4" :key"n" 但是,使用 'n' 作为 src 的一部分不起作用。为什么? <div v-for="n in 4" :key="n"> <img :src="`../assets/images/image-product-${n}-thumbnail.jpg`" class="rounded-xl h-16 w-16 hover:cursor-pointer" /> </div> 尝试使用“key”代替“n”,将“n”转换为字符串...没有成功 如果我像这样硬编码,它会起作用 <img src="../assets/images/image-product-1-thumbnail.jpg" class="rounded-xl h-16 w-16 hover:cursor-pointer" /> 如果您有可用的全局别名(@),我建议您使用它。 因为使用相对路径可以在本地工作,但是当项目编译(构建)时,相关路径可能会被破坏。 使用动态 src 路径时,您可以在加载之前需要它。 使用别名,您可以执行以下操作: :src="`require(@/assets/images/image-product-${n}-thumbnail.jpg`)"


Python 3.7 BeautifullSoup soup.find 错误 - find() 不接受关键字参数

我从 URL 获得了以下 HTML: 我从 URL 中获得了以下 HTML: <h4> \r\n \r\n\r\n <a href="/l"> \r\n <!-- mp_trans_rt_start id="1" args="as" 1 -->\r\n <span class="brandWrapTitle">\r\n <span class="productdescriptionbrand">Mxxx</span>\r\n </span>\r\n <span class="nameWrapTitle">\r\n <span class="productdescriptionname">Axxxname</span>\r\n </span>\r\n <!-- mp_trans_rt_end 1 -->\r\n </a> \r\n\r\n </h4> 我正在尝试使用 python 来查找类名: import urllib.request from bs4 import BeautifulSoup url = "https://link" user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' urlwithagent = urllib.request.Request(url,headers={'User-Agent': user_agent}) response = urllib.request.urlopen(urlwithagent) soup = response.read() product = soup.find("h4", attrs ={"class=": "productdescriptionname"}) print (product) Everythink 完美运行直到上线: product = soup.find("h4", attrs ={"class=": "productdescriptionname"}) 我收到如下错误: find() takes no keyword arguments 我不知道如何解决它 - 有很多信息,但没有任何作用:/ 在使用 BeautifulSoup 之前,您需要将其转换为 find 对象,否则它会使用 str.find 例如: soup = BeautifulSoup(response.read(), "html.parser") product = soup.find("h4", attrs ={"class": "productdescriptionname"}) print (product) 我认为这值得一提,如果 find 方法有问题,检查 type(soup) 是一个很好的方法来查明您是否正在使用正确的 bs4.BeautifulSoup 对象而不是 str。 我想在这里指出一件事,如果使用 soup.prettify() 使 html 可读。需要注意的是,.prettify() 将 bs4.BeautifulSoup 转换为 str。所以这应该单独使用,例如: soup = BeautifulSoup(response) # type(soup) --> bs4.BeautifulSoup print(soup.prettify()) # print readable html 不喜欢: soup = BeautifulSoup(response).prettify() # type(soup) --> str 我在网上读到的关于这个问题的另一件事是这样的:“你的 beautiful soup 版本可能不支持 find。”因此,我最终升级和降级了版本很多次,然后才意识到这是一个错误的陈述由业余爱好者制作。 在打印之前我已经为此奋斗了大约 45 分钟type(soup)。我希望这可以节省其他人的时间。 Может кому подойдет история такая повторял за автором ютуба и переписывал код для парсинга и вышла такая же ошибка как в вопросе искал читал, шерстил инет пока не начал перепроверять свой код в общем мой код с ошибкой: from requests import Session from bs4 import BeautifulSoup as BS from time import sleep headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 YaBrowser/23.11.0.0 Safari/537.36'} work = Session() work.get('https://quotes.toscrape.com/', headers=headers) response = work.get('https://quotes.toscrape.com/login', headers=headers) soup = BS(response.text, 'lxml') token = soup.find('from').find('input').get('') в чем здесь ошибка? вот в этой строке token = soup.find('from').find('input').get('') а именно soup.find('from') я решил скать ошибку методом исключения поэтому довел до такого состояния и понял что в странице нет тэга '来自' а есть тэг '形式' как только поменял на тэг 'form' ошибка с soup.find() - find() ушла может кому поможет


如何在 Abap Simple Transformation 中添加 XML 命名空间

我使用简单转换从内部表中获取 XML。这是输出 XML。 我使用简单转换从内部表中获取 XML。这是输出 XML。 <?xml version="1.0" encoding="UTF-8"?> <Complement> <Document Doc="AAA"> <Locations> <Location> <Origin RFC="URE180429TM6"/> <Address Country="SOME_COUNTRY" /> [....] </Location> </Locations> <Products NumTotal="1"> <Product ValorProduct="12164501" /> [....] </Product> </Products> [....].... </Document> </Complement> 但是现在我需要做的是更改一些 XML 元素名称(重命名它们)..这应该使我的 XML 看起来像这样: 例如,我需要第一个元素(补语)看起来像 cfdi:Complement (在 cfdi 和补语之间使用冒号 :)...等等等等 <cfdi:Complement> <document:Document Doc="AAA"> <document:Locations> <document:Location> <document:Origin RFC="URE180429TM6"/> <document:Domicilio Country="NIGERIA" /> [....] </document:Location> </document:Locations> <document:Products NumTotal="1"> <document:Product ValorProduct="12164501" /> [....] </document:Product> </document:Products> [....].... </document:Document> </cfdi:Complement> 我一直在尝试直接从简单转换代码更改元素名称,但它不起作用: <?sap.transform simple?> <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined"> <tt:root name="COMPLEMENT" type="ddic:ZCOMPLEMENT"/> <tt:template> <tt:namespace name="cfdi"/> <tt:namespace name="document"/> <cfdi:Complement> "<----- I get error from this lines <document:Document> "<----- I get error from this lines <tt:attribute name="Doc" value-ref=".COMPLEMENT.DOCUMENT.DOC"/> <document:Locations> <Location> <Origin> <tt:attribute name="RFC" value-ref=".COMPLEMENT.DOCUMENT.LOCATIONS.LOCATION.ORIGIN.RFC"/> [....] </Origin> <Address> <tt:attribute name="Country" value-ref=".COMPLEMENT.DOCUMENT.LOCATIONS.LOCATION.ADDRESS.COUNTRY"/> [....] </Address> </Location> </Locations> <Products> <tt:attribute name="NumTotal" value-ref=".COMPLEMENT.DOCUMENT.PRODUCTS.NUMTOTAL"/> <Product> <tt:attribute name="ValorProduct" value-ref="VALORPRODUCT"/> [....] </Product> </Products> [....].... </Document> </Complement> </tt:template> </tt:transform> 这些是我得到的错误: undeclared namespace prefix 'cfdi' 和 undeclared namespace prefix 'document' 这是简单的转换代码: 我只需要更改Element的名称即可。但我不认为这比看起来更难。 请帮我解决这个问题。我是这个 Abap 世界的新人。或者任何想法都会对我有很大帮助。问候 我之前遇到过一些命名空间问题,也许这个线程有帮助。 这是参考代码。正如您所看到的,您必须定义名称空间并按定义方式使用它,此处为 ns1。 <tt:template> <top_element xmlns:ns1="xsd/namespacesForBoxes" xmlns:ns2="xsd/namespacesForCartons" xmlns:ns3="xsd/namespacesForPallets"> <tt:namespace name="ns1"/> <tt:namespace name="ns2"/> <tt:namespace name="ns3"/> <tt:cond s-check="not-initial(ref('.telegram.BOX_ID'))"> <ns1:container> <tt:attribute name="box-id" value-ref=".telegram.BOX_ID"/> </ns1:container> </tt:cond> <tt:cond s-check="not-initial(ref('.telegram.CARTON_ID'))"> <ns2:container> <tt:attribute name="carton-id" value-ref=".telegram.CARTON_ID"/> </ns2:container> </tt:cond> <tt:cond s-check="not-initial(ref('.telegram.PALLET_ID'))"> <ns3:container> <tt:attribute name="pallet-id" value-ref=".telegram.PALLET_ID"/> </ns3:container> </tt:cond> </top_element> </tt:template> 之后应该是这样的: <top_element xmlns:ns1="xsd/namespacesForBoxes" xmlns:ns2="xsd/namespacesForCartons" xmlns:ns3="xsd/namespacesForPallets"> <ns1:container box-id="BOX"/> <ns2:container carton-id="CARTON"/> <ns3:container pallet-id="PALLET"/> </top_element> “tt:cond”只是为了让丢失的 XML 标签或不同顺序的标签不会扰乱你的转换。


Laravel 购物车页面,表单内有一个表单,用于处理删除和提交数据更新数据库

我有一个购物车页面,表格内有一个表格,也许你可以建议我应该做什么? 根据图片,我给出的蓝色圆圈是一个表格 我的刀片代码 我有一个购物车页面,表格内有一个表格,也许你可以建议我应该做什么?根据图片我给出的蓝色圆圈是一个表格我的刀片代码<table class="table"> <thead> <tr> <th scope="col">No</th> <th scope="col">Nama Barang</th> <th scope="col">Quantity</th> <th scope="col">Action</th> </tr> </thead> <tbody> @php $no = 1; @endphp @forelse ($permintaans as $b) <tr> <td>{{ $no ++ }}</td> <td> {{ $b->nama_kategori }} {{ $b->nama_atk }} </td> <td> <form action="{{ route('permintaan.update', $b->id) }}" method="POST" style="display: inline-block;"> @csrf @method('PUT') <div class="input-group input-group-sm mb-3"> <input type="number" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="satuan_permintaan" min="0" max={{ $b->stok }} required> <span class="input-group-text" id="inputGroup-sizing-sm">{{ $b->subsatuan_atk }}</span> </div> </td> <td> <form action="{{ route('permintaan.destroy', $b->id) }}" method="POST" style="display: inline-block;"> @csrf @method('DELETE') <button type="submit" class="btn custom2-btn"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="red" class="bi bi-trash" viewBox="0 0 16 16"> <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/> <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/> </svg></button> </form> </td> </tr> @empty @endforelse </tbody> </table> 我的控制器public function store(Request $request) { $task = new Permintaan(); $task->atk_id = $request->input('atk_id'); $task->proses = 'Proses'; if (Permintaan::where('atk_id', $task->atk_id)->exists()){ return redirect('/atk/permintaan')->with(['info' => 'ATK Sudah Dalam Permintaan']); } else{ $task->save(); return redirect()->route('permintaan.index'); } } public function destroy($id) { $permintaan = Permintaan::find($id); $permintaan->delete(); return redirect()->route('permintaan.index'); } 我要处理删除并提交数据更新数据库 在开始销毁表单之前关闭更新表单第一个表单标签(缺少)。


我无法用vue.js显示json

我需要使用 v-for 显示 json 中的产品数组,但我无法这样做。 我正在尝试显示产品数组中的 json 数据,但它不起作用。 Vue.js 我需要使用 v-for 显示 json 中的产品数组,但我无法这样做。 我正在尝试显示产品数组中的 json 数据,但它不起作用。 Vue.js <div class="box" v-for="product in products" :key="product.id"> <h2>Produto {{ product.name }}</h2> <h3>Situação {{ product.situation }}</h3> </div> export default { data() { return { products: [], }; }, methods: { async getData() { try { const req = await fetch("http://localhost:3000/products"); const data = await req.json(); this.products = data.products; console.log("data" + data); } catch (error) { console.error("Error fetching data:", error); } }, mounted() { this.getData(); }, }, }; JSON: { "products": [ { "id": "a898", "name": "Claudio Romano", "situation": "Ativo" } ] } 您问错了问题,因为该问题与 JSON 无关。如果您对此进行调试,您会注意到 console.logs 不执行,这意味着问题更为根本,因为该方法本身并未实际运行。 根本问题是mounted()不应该在methods内部。您正在使用 Vue 的选项 API,其中 data()、methods 和 mounted 都是独立的、单独的“选项”。您需要将安装移动到方法之外,它应该是一个“兄弟”选项。 export default { data() { ... }, methods: { ... }, mounted() { this.getData(); }, }; 游乐场演示


XSL/XSLT - 动态获取父节点及其值

有人可以帮助我吗?我有一个 xml,可以在其中获取节点中节点的名称,例如值、宽度、高度、重量…… 例子: 有人可以帮助我吗?我有一个 xml,可以在其中获取节点中节点的名称,例如值、宽度、高度、重量…… 示例: <?xml version="1.0" encoding="utf-8"?> <Data totalExecutionTime="00:00:00.0076034" totalCount="1">   <Features>     <ProductID id="100" language="NLB" caption="Product ID" captionAlternative="Product ID" unit="" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="" viewGroup="" viewGroupOrder="0" topViewGroupId="b65b432a-1bf1-4fd4-ae92-03418d3204be" topViewGroup="Algemeen" topViewGroupOrder="1" viewOrder="0" form="Complex" dataType="String" readOnly="False" />     <Length id="245" language="NLB" caption="Lengte" captionAlternative="Lengte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="1" form="Simple" dataType="Number" readOnly="False" />     <Width id="242" language="NLB" caption="Breedte" captionAlternative="Breedte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="2" form="Simple" dataType="Number" readOnly="False" />     <Height id="244" language="NLB" caption="Hoogte" captionAlternative="Hoogte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="3" form="Simple" dataType="Number" readOnly="False" />     <Depth id="771" language="NLB" caption="Diepte" captionAlternative="Diepte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="4" form="Simple" dataType="Number" readOnly="False" />     <Weight id="243" language="NLB" caption="Gewicht" captionAlternative="Gewicht" unit="kg" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="5" form="Simple" dataType="Number" readOnly="False" />     <LoadCapacity id="457" language="NLB" caption="Draagvermogen" captionAlternative="Draagvermogen" unit="kg" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="6" form="Simple" dataType="Number" readOnly="False" />     <Volume id="435" language="NLB" caption="Inhoud" captionAlternative="Inhoud" unit="l" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="bfaf678b-8b9d-4cea-aa99-08edd8316dc7" viewGroup="Algemene specificaties" viewGroupOrder="13" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="7" form="Simple" dataType="Number" readOnly="False" />     <TireSize id="705" language="NLB" caption="Banden maat" captionAlternative="Banden maat" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="8" form="Simple" dataType="String" readOnly="False" />     <LoadingScoop id="706" language="NLB" caption="Laadschep" captionAlternative="Laadschep" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="9" form="Simple" dataType="String" readOnly="False" />   </Features>   <ProductID id="25137" parentId="0" brand="Normal" order="0" createdDate="2020-03-24T15:30:07.21" modifiedDate="2023-11-20T20:01:33.87">     <Value seq="0" modifiedDate="2020-03-24T15:30:10.493">111TA5851</Value>     <Width seq="0" modifiedDate="2020-03-24T15:30:10.493">515</Width>     <Height seq="0" modifiedDate="2020-03-24T15:30:10.493">1100</Height>     <Weight seq="0" modifiedDate="2020-04-02T13:18:09.44">7.7</Weight>     <LoadCapacity seq="0" modifiedDate="2020-03-24T15:30:10.493">150</LoadCapacity>     <LoadingScoop seq="0" modifiedDate="2020-03-24T15:30:10.493">350x170</LoadingScoop>   </ProductID> </Data> 我想要的是动态获取对应父节点的值。我可以获得如下节点名称: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <table> <xsl:for-each select="/Data/ProductID/*"> <xsl:variable name="myVariable" select="name(.)"/> <xsl:variable name="HasValue" select="count(/Data/ProductID/*)" /> <tr> <td><xsl:value-of select="name(.)" /></td> <td><xsl:value-of select="local-name()" /></td> <td><xsl:value-of select="name()" /></td> <td><xsl:value-of select="/Data/node($myVariable)/@unit" /></td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> 但我不知道如何获取响应的父节点及其值,例如单位元素。 提前致谢并致以诚挚的问候 我已经尝试过但没用。我会不断收到错误:解析 '' 期间出现意外的标记 '$myVariable'。 我想你想声明一把钥匙 <xsl:key name="element-key" match="Data/Features" use="name()"/> 然后你想使用例如key('element-name', name())/@unit。


动态获取父节点及其值

我有一个xml,我可以在其中获取节点中节点的名称,例如值、宽度、高度、重量... 例子: 我有一个 xml,可以在其中获取节点中节点的名称,例如值、宽度、高度、重量…… 示例: <?xml version="1.0" encoding="utf-8"?> <Data totalExecutionTime="00:00:00.0076034" totalCount="1">   <Features>     <ProductID id="100" language="NLB" caption="Product ID" captionAlternative="Product ID" unit="" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="" viewGroup="" viewGroupOrder="0" topViewGroupId="b65b432a-1bf1-4fd4-ae92-03418d3204be" topViewGroup="Algemeen" topViewGroupOrder="1" viewOrder="0" form="Complex" dataType="String" readOnly="False" />     <Length id="245" language="NLB" caption="Lengte" captionAlternative="Lengte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="1" form="Simple" dataType="Number" readOnly="False" />     <Width id="242" language="NLB" caption="Breedte" captionAlternative="Breedte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="2" form="Simple" dataType="Number" readOnly="False" />     <Height id="244" language="NLB" caption="Hoogte" captionAlternative="Hoogte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="3" form="Simple" dataType="Number" readOnly="False" />     <Depth id="771" language="NLB" caption="Diepte" captionAlternative="Diepte" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="4" form="Simple" dataType="Number" readOnly="False" />     <Weight id="243" language="NLB" caption="Gewicht" captionAlternative="Gewicht" unit="kg" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="28813941-54b4-4511-b91e-d9ae53aa03e9" viewGroup="Afmetingen en gewicht" viewGroupOrder="91" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="5" form="Simple" dataType="Number" readOnly="False" />     <LoadCapacity id="457" language="NLB" caption="Draagvermogen" captionAlternative="Draagvermogen" unit="kg" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="6" form="Simple" dataType="Number" readOnly="False" />     <Volume id="435" language="NLB" caption="Inhoud" captionAlternative="Inhoud" unit="l" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="bfaf678b-8b9d-4cea-aa99-08edd8316dc7" viewGroup="Algemene specificaties" viewGroupOrder="13" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="7" form="Simple" dataType="Number" readOnly="False" />     <TireSize id="705" language="NLB" caption="Banden maat" captionAlternative="Banden maat" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="8" form="Simple" dataType="String" readOnly="False" />     <LoadingScoop id="706" language="NLB" caption="Laadschep" captionAlternative="Laadschep" unit="mm" help="" abbr="" groupId="73660834-eea8-4d67-8e84-b38e2742706a" group="Alles" groupOrder="0" viewGroupId="c9d7dd7e-8a85-47cc-8542-2695e4615f75" viewGroup="Technische specificaties" viewGroupOrder="15" topViewGroupId="590c0ee7-e1eb-4e18-b583-eba8984ffe82" topViewGroup="Specificaties" topViewGroupOrder="4" viewOrder="9" form="Simple" dataType="String" readOnly="False" />   </Features>   <ProductID id="25137" parentId="0" brand="Normal" order="0" createdDate="2020-03-24T15:30:07.21" modifiedDate="2023-11-20T20:01:33.87">     <Value seq="0" modifiedDate="2020-03-24T15:30:10.493">111TA5851</Value>     <Width seq="0" modifiedDate="2020-03-24T15:30:10.493">515</Width>     <Height seq="0" modifiedDate="2020-03-24T15:30:10.493">1100</Height>     <Weight seq="0" modifiedDate="2020-04-02T13:18:09.44">7.7</Weight>     <LoadCapacity seq="0" modifiedDate="2020-03-24T15:30:10.493">150</LoadCapacity>     <LoadingScoop seq="0" modifiedDate="2020-03-24T15:30:10.493">350x170</LoadingScoop>   </ProductID> </Data> 我想要的是动态获取对应父节点的hte值。我可以获得如下节点名称: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <table> <xsl:for-each select="/Data/ProductID/*"> <xsl:variable name="myVariable" select="name(.)"/> <xsl:variable name="HasValue" select="count(/Data/ProductID/*)" /> <tr> <td><xsl:value-of select="name(.)" /></td> <td><xsl:value-of select="local-name()" /></td> <td><xsl:value-of select="name()" /></td> <td><xsl:value-of select="/Data/node($myVariable)/@unit" /></td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> 但是我不知道如何获取相应的父节点及其值,例如单位元素。 我已经尝试过<xsl:value-of select="/Data/$myVariable/@unit" /></td>,但不起作用。我会不断收到错误:Unexpected token '$myVariable' during parsing of '<AnyKindTest>'。 我想你想声明一把钥匙 <xsl:key name="element-key" match="Data/Features" use="name()"/> 然后你想使用例如key('element-key', name())/@unit。 你写道: <xsl:value-of select="/Data/$myVariable/@unit" /> 我认为你的问题可能是重复的 使用 2 个参数进行 xslt 测试 您正在尝试使用 $myVariable,就好像它所保存的字符串可以以文本方式替换到您的 XPath 表达式中一样。您可能想要的是 /Data/*[name()=$myVariable]/@unit 很多人都犯过这个错误,但我不知道为什么。我不认为人们会将变量 $op 设置为“+”或“-”,然后期望 @x $op @y 执行适当的加法或减法。除非他们以前的编程经验完全是用宏语言。


用 Bootsrap 制作的网站右侧的空间不会消失吗?

无论我做什么,我用 Bootsrap 制作的网站右侧的空白都没有消失。如果有解决办法请告诉我 无论我做什么,我用 Bootsrap 制作的网站右侧的空白都没有消失。如果有解决办法请告诉我 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Contact | Enba Camping</title> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> <link rel="stylesheet" href="style/style.css"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> </head> <body> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> <!-- NAV --> <div class="container-fluid"> <div class="row"> <div class="col-sm-12 p-0"> <nav class="navbar navbar-expand-lg bg-body-tertiary p-0 "> <div class="container-fluid bg-dark "> <a class="navbar-brand text-light mb-2" href="index.html">Enba Camping</a> <button class="navbar-toggler btn btn-light btn btn-outline-light bg-light m-2" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon "></span> </button> <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="navbar-nav ms-auto"> <a class="nav-link text-light text-center" aria-current="page" href="index.html">Home</a> <a class="nav-link text-light text-center" href="aboutus.html">About us</a> <a class="nav-link active text-light text-center" href="contact.html" aria-disabled="true">Contact</a> </div> </div> </div> </nav> </div> </div> </div> <!-- NAV END --> <!-- ABOUT US --> <div class="container-fluid p-0 bg-dark text-light"> <div class="row"> <div class="col-sm-6 ps-0"> <img src="images/lesly-derksen-F4fH5dAfZnE-unsplash.jpg" alt="" class=" d-block w-100 c-img "> </div> <div class="col-sm-6 d-flex justify-content-center align-items-center "> <div class="text-center"> <h2 class="fw-bold display-4 ">Bize Ulaşın</h2> <!-- ABOUT US --> <div class="mb-3"> <label for="exampleFormControlInput1" class="form-label">Adınız</label> <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="Name"> </div> <div class="mb-3"> <label for="exampleFormControlInput1" class="form-label">Email Adres</label> <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="Email Address"> </div> <div class="mb-3"> <label for="exampleFormControlTextarea1" class="form-label">Mesajınız</label> <textarea class="form-control" id="exampleFormControlTextarea1" placeholder="Message" rows="3"></textarea> </div> <div class=" gap-2 d-md-block "> <button class="btn btn-light " type="button">Send</button> </div> </div> </div> </div> </div> <!-- ABOUT US END --> <!-- PRODUCT --> <div class="container mt-sm-5"> <div class="row text-center "> <h1 class="d-flex justify-content-center">Mekanlarımız</h1> <hr> <div class="col-sm-4 mb-2"> <div class="card"> <img src="images/card2.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Orman İçi Karavan Parkı</h5> <p class="card-text">Ormanın içinde konumlanan karavan parkımız, tam anlamıyla bir doğa kaçamağı sunuyor. Ormanın huzurlu atmosferinde kendinizi kaybedin. Karavanınızla konforlu bir konaklama deneyimi yaşayın.</p> <a href="#" class="btn btn-dark">Rezervasyon için tıklayınız </a> </div> </div> </div> <div class="col-sm-4 mb-2"> <div class="card"> <img src="images/card3.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Orman İçi Çadırlı Kamp</h5> <p class="card-text">Orman içi çadırlı kamp alanımız, doğa severler için bir cennet. Gölgeli ağaçlar arasında konumlanan çadırlarımızda, kuş cıvıltıları ve huzur içinde bir konaklama deneyimi sizi bekliyor.</p> <a href="#" class="btn btn-dark">Rezervasyon için tıklayınız</a> </div> </div> </div> <div class="col-sm-4 mb-2"> <div class="card"> <img src="images/card1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Dağ Evi </h5> <p class="card-text">Dağ evimiz, şehrin gürültüsünden uzak,huzurlu bir konaklama imkanı sunuyor. Ferah odalarımızda dağ manzarasının keyfini çıkarabilir, gölet kenarındaki aktivitelerle vakit geçirebilirsiniz.</p> <a href="#" class="btn btn-dark">Rezervasyon için tıklayınız</a> </div> </div> </div> </div> </div> <!-- PRODUCT END --> <!-- PROJECT --> <div class="row my-4"> <div class="col-sm-12"> <h1 class="d-flex justify-content-center">Galeri</h1> <hr> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/hichem-meghachou-7I-Rj_E9ihI-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/jimmy-conover-J_XuXX9m0KM-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/josh-campbell-UbbjVyibFuc-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/shelby-cohron-ESNV6KmLJMg-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/tegan-mierle-fDostElVhN8-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> <div class="col-sm col-6 mb-1"><img src="images/galeri/toa-heftiba-x9I-6yoXrXE-unsplash.jpg" alt="" class="w-100 img-thumbnail"> </div> </div> <!-- PROJECT END --> <!-- FOOTER --> <div class="bg-dark text-light"> <div class="container"> <footer class="pt-5 mt-5 "> <div class="row "> <div class="col-6 col-md-2 mb-3"> <h5>Section</h5> <ul class="nav flex-column "> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Home</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Features</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Pricing</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">FAQs</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">About</a> </li> </ul> </div> <div class="col-6 col-md-2 mb-3"> <h5>Section</h5> <ul class="nav flex-column"> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Home</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Features</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Pricing</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">FAQs</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">About</a> </li> </ul> </div> <div class="col-6 col-md-2 mb-3"> <h5>Section</h5> <ul class="nav flex-column"> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Home</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Features</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">Pricing</a> </li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">FAQs</a></li> <li class="nav-item mb-2"><a href="#" class="nav-link p-0 text-light">About</a> </li> </ul> </div> <div class="col-md-5 offset-md-1 mb-3"> <form> <h4> Abone Ol ve Doğanın Güzelliklerini Kaçırma!</h4> <p class="fs-6">Doğanın kucaklayıcı atmosferine adım atmak, huzurla dolu anlar yaşamak ve Enba Camping'in sunduğu özel fırsatları kaçırmamak için hemen abone ol! Sitemize abone olarak, doğanın gizemli güzellikleri, özel indirimler ve etkinliklerden ilk sen haberdar olacaksın.</p> <p class="fs-6"> Unutulmaz anılar biriktirmek ve doğanın kollarında huzurlu bir deneyim yaşamak için abone ol, Enba Camping'in eşsiz dünyasına adımını at! 🏕️✨ </p> <div class="d-flex flex-column flex-sm-row w-100 gap-2"> <label for="newsletter1" class="visually-hidden">Email address</label> <input id="newsletter1" type="text" class="form-control" placeholder="Email address"> <button class="btn btn-primary" type="button">Subscribe</button> </div> </form> </div> </div> <div class="d-flex flex-column flex-sm-row justify-content-between border-top"> <p>© 2023 Company, Inc. All rights reserved.</p> <ul class="list-unstyled d-flex"> <li class="ms-3"><a class="link-body-emphasis" href="#"><svg class="bi" width="24" height="24"> <use xlink:href="#twitter"></use> </svg></a></li> <li class="ms-3"><a class="link-body-emphasis" href="#"><svg class="bi" width="24" height="24"> <use xlink:href="#instagram"></use> </svg></a></li> <li class="ms-3"><a class="link-body-emphasis" href="#"><svg class="bi" width="24" height="24"> <use xlink:href="#facebook"></use> </svg></a></li> </ul> </div> </footer> </div> </div> <!-- FOOTER END --> </body> </html> 和CSS .jumb { vertical-align: inherit; } p { font-size: 24px; } .c-item { height: 480px; } .c-img { height: 100%; object-fit: cover; filter:brightness(0.9) } 这里。我不希望页面左右移动。我想让它适合全屏,但容器结构溢出了 请将这段代码添加到您的 CSS 文件中。然后,它就会起作用。 .row{ margin-right: 0px; }


© www.soinside.com 2019 - 2024. All rights reserved.